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