Changeset 7464 for branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Timestamp:
- 02/07/12 16:50:35 (13 years ago)
- Location:
- branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
r7459 r7464 51 51 } 52 52 53 public IEnumerable<double> Weights { 54 get { return new List<double>(weights); } 55 } 56 53 57 [Storable] 54 58 private Dictionary<IClassificationModel, IntRange> trainingPartitions; … … 56 60 private Dictionary<IClassificationModel, IntRange> testPartitions; 57 61 62 private IEnumerable<double> weights; 63 58 64 private IClassificationEnsembleSolutionWeightCalculator weightCalculator; 65 66 public IClassificationEnsembleSolutionWeightCalculator WeightCalculator { 67 set { 68 if (value != null) { 69 weightCalculator = value; 70 weights = weights = weightCalculator.CalculateWeights(classificationSolutions); 71 if (!ProblemData.IsEmpty) 72 RecalculateResults(); 73 } 74 } 75 } 59 76 60 77 [StorableConstructor] … … 98 115 classificationSolutions = new ItemCollection<IClassificationSolution>(); 99 116 100 weightCalculator = new AccuracyWeightCalculator();117 weightCalculator = new MajorityVoteWeightCalculator(); 101 118 102 119 RegisterClassificationSolutionsEventHandler(); … … 158 175 .ToList(); 159 176 var rowsEnumerator = rows.GetEnumerator(); 160 IEnumerable<double> weights = weightCalculator.CalculateWeights(classificationSolutions);161 177 // aggregate to make sure that MoveNext is called for all enumerators 162 178 while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) { … … 178 194 .ToList(); 179 195 var rowsEnumerator = ProblemData.TestIndizes.GetEnumerator(); 180 IEnumerable<double> weights = weightCalculator.CalculateWeights(classificationSolutions);181 196 // aggregate to make sure that MoveNext is called for all enumerators 182 197 while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) { … … 203 218 204 219 public override IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows) { 205 IEnumerable<double> weights = weightCalculator.CalculateWeights(classificationSolutions);206 220 return from xs in GetEstimatedClassValueVectors(ProblemData.Dataset, rows) 207 221 select AggregateEstimatedClassValues(xs, weights); … … 302 316 trainingPartitions[solution.Model] = solution.ProblemData.TrainingPartition; 303 317 testPartitions[solution.Model] = solution.ProblemData.TestPartition; 318 weights = weightCalculator.CalculateWeights(classificationSolutions); 304 319 } 305 320 … … 309 324 trainingPartitions.Remove(solution.Model); 310 325 testPartitions.Remove(solution.Model); 326 weights = weightCalculator.CalculateWeights(classificationSolutions); 311 327 } 312 328 } -
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AccuracyWeightCalculator.cs
r7459 r7464 28 28 namespace HeuristicLab.Problems.DataAnalysis { 29 29 /// <summary> 30 /// Represents a weight calculator that gives every classification solution a weight based on the accuracy. .30 /// Represents a weight calculator that gives every classification solution a weight based on the accuracy. 31 31 /// </summary> 32 32 [StorableClass]
Note: See TracChangeset
for help on using the changeset viewer.