Changeset 7596
- Timestamp:
- 03/12/12 11:21:37 (13 years ago)
- Location:
- branches/ClassificationEnsembleVoting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r7458 r7596 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath> $(SolutionDir)\bin\</OutputPath>52 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r7531 r7596 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath> $(SolutionDir)\bin\</OutputPath>52 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
r7562 r7596 52 52 53 53 private IClassificationEnsembleSolutionWeightCalculator weightCalculator; 54 55 54 public IClassificationEnsembleSolutionWeightCalculator WeightCalculator { 56 55 set { … … 64 63 } 65 64 65 [Storable] 66 private Dictionary<IClassificationModel, IntRange> trainingPartitions; 67 [Storable] 68 private Dictionary<IClassificationModel, IntRange> testPartitions; 69 66 70 [StorableConstructor] 67 71 private ClassificationEnsembleSolution(bool deserializing) … … 73 77 foreach (var model in Model.Models) { 74 78 IClassificationProblemData problemData = (IClassificationProblemData)ProblemData.Clone(); 79 problemData.TrainingPartition.Start = trainingPartitions[model].Start; 80 problemData.TrainingPartition.End = trainingPartitions[model].End; 81 problemData.TestPartition.Start = testPartitions[model].Start; 82 problemData.TestPartition.End = testPartitions[model].End; 83 75 84 classificationSolutions.Add(model.CreateClassificationSolution(problemData)); 76 85 } … … 80 89 private ClassificationEnsembleSolution(ClassificationEnsembleSolution original, Cloner cloner) 81 90 : base(original, cloner) { 91 trainingPartitions = new Dictionary<IClassificationModel, IntRange>(); 92 testPartitions = new Dictionary<IClassificationModel, IntRange>(); 93 foreach (var pair in original.trainingPartitions) { 94 trainingPartitions[cloner.Clone(pair.Key)] = cloner.Clone(pair.Value); 95 } 96 foreach (var pair in original.testPartitions) { 97 testPartitions[cloner.Clone(pair.Key)] = cloner.Clone(pair.Value); 98 } 99 100 weightCalculator = cloner.Clone(original.weightCalculator); 82 101 classificationSolutions = cloner.Clone(original.classificationSolutions); 83 102 RegisterClassificationSolutionsEventHandler(); … … 86 105 public ClassificationEnsembleSolution() 87 106 : base(new ClassificationEnsembleModel(), ClassificationEnsembleProblemData.EmptyProblemData) { 107 trainingPartitions = new Dictionary<IClassificationModel, IntRange>(); 108 testPartitions = new Dictionary<IClassificationModel, IntRange>(); 88 109 classificationSolutions = new CheckedItemCollection<IClassificationSolution>(); 89 90 110 weightCalculator = new MajorityVoteWeightCalculator(); 91 111 … … 101 121 public ClassificationEnsembleSolution(IEnumerable<IClassificationModel> models, IClassificationProblemData problemData, IEnumerable<IntRange> trainingPartitions, IEnumerable<IntRange> testPartitions) 102 122 : base(new ClassificationEnsembleModel(Enumerable.Empty<IClassificationModel>()), new ClassificationEnsembleProblemData(problemData)) { 123 this.trainingPartitions = new Dictionary<IClassificationModel, IntRange>(); 124 this.testPartitions = new Dictionary<IClassificationModel, IntRange>(); 103 125 this.classificationSolutions = new CheckedItemCollection<IClassificationSolution>(); 104 126 … … 123 145 RegisterClassificationSolutionsEventHandler(); 124 146 classificationSolutions.AddRange(solutions); 147 weightCalculator = new MajorityVoteWeightCalculator(); 125 148 } 126 149 … … 195 218 solution.ProblemData = problemData; 196 219 } 220 foreach (var trainingPartition in trainingPartitions.Values) { 221 trainingPartition.Start = ProblemData.TrainingPartition.Start; 222 trainingPartition.End = ProblemData.TrainingPartition.End; 223 } 224 foreach (var testPartition in testPartitions.Values) { 225 testPartition.Start = ProblemData.TestPartition.Start; 226 testPartition.End = ProblemData.TestPartition.End; 227 } 228 197 229 base.OnProblemDataChanged(); 198 230 } … … 225 257 if (Model.Models.Contains(solution.Model)) throw new ArgumentException(); 226 258 Model.Add(solution.Model); 259 trainingPartitions[solution.Model] = solution.ProblemData.TrainingPartition; 260 testPartitions[solution.Model] = solution.ProblemData.TestPartition; 227 261 } 228 262 … … 230 264 if (!Model.Models.Contains(solution.Model)) throw new ArgumentException(); 231 265 Model.Remove(solution.Model); 266 trainingPartitions.Remove(solution.Model); 267 testPartitions.Remove(solution.Model); 232 268 } 233 269 }
Note: See TracChangeset
for help on using the changeset viewer.