Changeset 7759 for branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Timestamp:
- 04/24/12 16:37:40 (13 years ago)
- Location:
- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r7758 r7759 191 191 <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project> 192 192 <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name> 193 <Private>False</Private> 193 194 </ProjectReference> 194 195 <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj"> -
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
r7758 r7759 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using System.Linq; 25 23 using HeuristicLab.Common; … … 34 32 [Creatable("Problems")] 35 33 public class SymbolicRegressionSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IRegressionProblemData, ISymbolicRegressionSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem, 36 IProblemInstanceConsumer<Regression Data>, IProblemInstanceExporter<RegressionData> {34 IProblemInstanceConsumer<RegressionProblemData>, IProblemInstanceExporter<RegressionProblemData> { 37 35 private const double PunishmentFactor = 10; 38 36 private const int InitialMaximumTreeDepth = 8; … … 116 114 } 117 115 118 public void Load(Regression Data data) {116 public void Load(RegressionProblemData data) { 119 117 Name = data.Name; 120 118 Description = data.Description; 121 Dataset dataset = new Dataset(data.InputVariables, data.Values); 122 ProblemData = new RegressionProblemData(dataset, data.AllowedInputVariables, data.TargetVariable); 123 ProblemData.TrainingPartition.Start = data.TrainingPartitionStart; 124 ProblemData.TrainingPartition.End = data.TrainingPartitionEnd; 125 ProblemData.TestPartition.Start = data.TestPartitionStart; 126 ProblemData.TestPartition.End = data.TestPartitionEnd; 119 ProblemData = new RegressionProblemData(data.Dataset, data.AllowedInputVariables, data.TargetVariable); 120 ProblemData.TrainingPartition.Start = data.TrainingPartition.Start; 121 ProblemData.TrainingPartition.End = data.TrainingPartition.End; 122 ProblemData.TestPartition.Start = data.TestPartition.Start; 123 ProblemData.TestPartition.End = data.TestPartition.End; 127 124 OnReset(); 128 125 } 129 126 130 public RegressionData Export() { 131 if (!ProblemData.InputVariables.Count.Equals(ProblemData.Dataset.DoubleVariables.Count())) 132 throw new ArgumentException("Not all input variables are double variables! (Export only works with double variables)"); 133 134 RegressionData regData = new RegressionData(); 127 public RegressionProblemData Export() { 128 RegressionProblemData regData = new RegressionProblemData(ProblemData.Dataset, ProblemData.AllowedInputVariables, ProblemData.TargetVariable); 135 129 regData.Name = Name; 136 130 regData.Description = Description; 137 regData.TargetVariable = ProblemData.TargetVariable; 138 regData.InputVariables = ProblemData.InputVariables.Select(x => x.Value).ToArray(); 139 regData.AllowedInputVariables = ProblemData.AllowedInputVariables.ToArray(); 140 regData.TrainingPartitionStart = ProblemData.TrainingPartition.Start; 141 regData.TrainingPartitionEnd = ProblemData.TrainingPartition.End; 142 regData.TestPartitionStart = ProblemData.TestPartition.Start; 143 regData.TestPartitionEnd = ProblemData.TestPartition.End; 144 145 List<List<double>> data = new List<List<double>>(); 146 foreach (var variable in ProblemData.Dataset.DoubleVariables) { 147 data.Add(ProblemData.Dataset.GetDoubleValues(variable).ToList()); 148 } 149 regData.Values = Transformer.Transformation(data); 150 131 regData.TrainingPartition.Start = ProblemData.TrainingPartition.Start; 132 regData.TrainingPartition.End = ProblemData.TrainingPartition.End; 133 regData.TestPartition.Start = ProblemData.TestPartition.Start; 134 regData.TestPartition.End = ProblemData.TestPartition.End; 151 135 return regData; 152 136 }
Note: See TracChangeset
for help on using the changeset viewer.