Changeset 5816 for branches/DataAnalysis SolutionEnsembles
- Timestamp:
- 03/23/11 12:54:57 (14 years ago)
- Location:
- branches/DataAnalysis SolutionEnsembles
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis SolutionEnsembles/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r5809 r5816 355 355 foreach (IResult result in ExtractAndAggregateResults<PercentValue>(resultCollections)) 356 356 results.Add(result.Name, result.Value); 357 357 foreach (IResult result in ExtractAndAggregateRegressionSolutions(resultCollections)) { 358 results.Add(result.Name, result.Value); 359 } 360 //foreach (IResult result in ExtractAndAggregateClassificationSolutions(resultCollections)) { 361 // results.Add(result.Name, result.Value); 362 //} 358 363 results.Add("Execution Time", new TimeSpanValue(this.ExecutionTime)); 359 364 results.Add("CrossValidation Folds", new RunCollection(runs)); 360 365 } 366 367 private IEnumerable<IResult> ExtractAndAggregateRegressionSolutions(IEnumerable<KeyValuePair<string, IItem>> resultCollections) { 368 Dictionary<string, List<IRegressionSolution>> resultSolutions = new Dictionary<string, List<IRegressionSolution>>(); 369 foreach (var result in resultCollections) { 370 var regressionSolution = result.Value as IRegressionSolution; 371 if (regressionSolution != null) { 372 if (resultSolutions.ContainsKey(result.Key)) { 373 resultSolutions[result.Key].Add(regressionSolution); 374 } else { 375 resultSolutions.Add(result.Key, new List<IRegressionSolution>() { regressionSolution }); 376 } 377 } 378 } 379 List<IResult> aggregatedResults = new List<IResult>(); 380 foreach (KeyValuePair<string, List<IRegressionSolution>> solutions in resultSolutions) { 381 var problemDataClone = (IRegressionProblemData)Problem.ProblemData.Clone(); 382 problemDataClone.TrainingPartition.Start = SamplesStart.Value; problemDataClone.TrainingPartition.End = SamplesEnd.Value; 383 problemDataClone.TestPartition.Start = SamplesStart.Value; problemDataClone.TestPartition.End = SamplesEnd.Value; 384 var ensembleSolution = new RegressionEnsembleSolution(solutions.Value.Select(x => x.Model), problemDataClone, 385 solutions.Value.Select(x => x.ProblemData.TrainingPartition), 386 solutions.Value.Select(x => x.ProblemData.TestPartition)); ; 387 388 aggregatedResults.Add(new Result(solutions.Key, ensembleSolution)); 389 } 390 return aggregatedResults; 391 } 392 393 //private IEnumerable<IResult> ExtractAndAggregateClassificationSolutions(IEnumerable<KeyValuePair<string, IItem>> resultCollections) { 394 // Dictionary<string, List<IClassificationSolution>> resultSolutions = new Dictionary<string, List<IClassificationSolution>>(); 395 // foreach (var result in resultCollections) { 396 // var classificationSolution = result.Value as IClassificationSolution; 397 // if (classificationSolution != null) { 398 // if (resultSolutions.ContainsKey(result.Key)) { 399 // resultSolutions[result.Key].Add(classificationSolution); 400 // } else { 401 // resultSolutions.Add(result.Key, new List<IClassificationSolution>() { classificationSolution }); 402 // } 403 // } 404 // } 405 // List<IResult> aggregatedResults = new List<IResult>(); 406 // foreach (KeyValuePair<string, List<IClassificationSolution>> solutions in resultSolutions) { 407 // var ensembleModel = new ClassificationEnsembleModel(solutions.Value.Select(x => x.Model)); 408 // var problemDataClone = (IClassificationProblemData)Problem.ProblemData.Clone(); 409 410 // problemDataClone.TrainingPartition.Start = SamplesStart.Value; problemDataClone.TrainingPartition.End = SamplesEnd.Value; 411 // problemDataClone.TestPartition.Start = SamplesStart.Value; problemDataClone.TestPartition.End = SamplesEnd.Value; 412 // aggregatedResults.Add(new Result(solutions.Key, new ClassificationSolution(ensembleModel, problemDataClone))); 413 // } 414 // return aggregatedResults; 415 //} 361 416 362 417 private static IEnumerable<IResult> ExtractAndAggregateResults<T>(IEnumerable<KeyValuePair<string, IItem>> results) -
branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r5809 r5816 109 109 <ItemGroup> 110 110 <Compile Include="DoubleLimit.cs" /> 111 <Compile Include="Implementation\Classification\ClassificationEnsembleModel.cs"> 112 <SubType>Code</SubType> 113 </Compile> 111 114 <Compile Include="Implementation\Classification\ClassificationProblemData.cs" /> 112 115 <Compile Include="Implementation\Classification\ClassificationProblem.cs" /> … … 115 118 <Compile Include="Implementation\Clustering\ClusteringProblemData.cs" /> 116 119 <Compile Include="Implementation\Clustering\ClusteringSolution.cs" /> 117 <Compile Include="Implementation\Classification\ClassificationEnsembleModel.cs" /> 120 <Compile Include="Implementation\Regression\RegressionEnsembleModel.cs"> 121 <SubType>Code</SubType> 122 </Compile> 123 <Compile Include="Implementation\Regression\RegressionEnsembleSolution.cs" /> 124 <Compile Include="Interfaces\Classification\IClassificationEnsembleModel.cs"> 125 <SubType>Code</SubType> 126 </Compile> 127 <Compile Include="Interfaces\Classification\IClassificationEnsembleSolution.cs" /> 118 128 <Compile Include="Interfaces\Classification\IDiscriminantFunctionThresholdCalculator.cs" /> 119 <Compile Include="Interfaces\Classification\IClassificationEnsembleModel.cs" /> 120 <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs" /> 129 <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs"> 130 <SubType>Code</SubType> 131 </Compile> 132 <Compile Include="Interfaces\Regression\IRegressionEnsembleSolution.cs" /> 121 133 <Compile Include="OnlineEvaluators\OnlineLinearScalingParameterCalculator.cs" /> 122 <Compile Include="Implementation\Regression\RegressionEnsembleModel.cs" />123 134 <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationModel.cs" /> 124 135 <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationSolution.cs" /> -
branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolution.cs
r5809 r5816 30 30 namespace HeuristicLab.Problems.DataAnalysis { 31 31 /// <summary> 32 /// Abstract base class for classification data analysis solutions32 /// Represents a classification data analysis solution 33 33 /// </summary> 34 34 [StorableClass] 35 public abstractclass ClassificationSolution : DataAnalysisSolution, IClassificationSolution {35 public class ClassificationSolution : DataAnalysisSolution, IClassificationSolution { 36 36 private const string TrainingAccuracyResultName = "Accuracy (training)"; 37 37 private const string TestAccuracyResultName = "Accuracy (test)"; … … 67 67 Add(new Result(TestAccuracyResultName, "Accuracy of the model on the test partition (percentage of correctly classified instances).", new PercentValue())); 68 68 RecalculateResults(); 69 } 70 71 public override IDeepCloneable Clone(Cloner cloner) { 72 return new ClassificationSolution(this, cloner); 69 73 } 70 74 -
branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringSolution.cs
r5809 r5816 27 27 namespace HeuristicLab.Problems.DataAnalysis { 28 28 /// <summary> 29 /// Abstract base class for clustering data analysis solutions29 /// Represents a clustering data analysis solution 30 30 /// </summary> 31 31 [StorableClass] 32 public abstractclass ClusteringSolution : DataAnalysisSolution, IClusteringSolution {32 public class ClusteringSolution : DataAnalysisSolution, IClusteringSolution { 33 33 34 34 [StorableConstructor] … … 39 39 public ClusteringSolution(IClusteringModel model, IClusteringProblemData problemData) 40 40 : base(model, problemData) { 41 } 42 43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new ClusteringSolution(this, cloner); 41 45 } 42 46 -
branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r5809 r5816 30 30 namespace HeuristicLab.Problems.DataAnalysis { 31 31 /// <summary> 32 /// Abstract base class for regression data analysis solutions32 /// Represents a regression data analysis solution 33 33 /// </summary> 34 34 [StorableClass] 35 public abstractclass RegressionSolution : DataAnalysisSolution, IRegressionSolution {35 public class RegressionSolution : DataAnalysisSolution, IRegressionSolution { 36 36 private const string TrainingMeanSquaredErrorResultName = "Mean squared error (training)"; 37 37 private const string TestMeanSquaredErrorResultName = "Mean squared error (test)"; … … 99 99 } 100 100 101 public override IDeepCloneable Clone(Cloner cloner) { 102 return new RegressionSolution(this, cloner); 103 } 104 101 105 protected override void OnProblemDataChanged(EventArgs e) { 102 106 base.OnProblemDataChanged(e);
Note: See TracChangeset
for help on using the changeset viewer.