Changeset 8297 for branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MajorityVoteWeightCalculator.cs
- Timestamp:
- 07/17/12 15:30:04 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MajorityVoteWeightCalculator.cs
r7866 r8297 61 61 return ((double)correctEstimated / (double)solutions.Count() - 0.5) * 2; 62 62 } 63 64 public override IEnumerable<double> GetConfidence(IEnumerable<IClassificationSolution> solutions, IEnumerable<int> indices, IEnumerable<double> estimatedClassValue) { 65 if (solutions.Count() < 1) 66 return Enumerable.Repeat(double.NaN, indices.Count()); 67 Dataset dataset = solutions.First().ProblemData.Dataset; 68 var estimationsPerSolution = solutions.Select(s => s.Model.GetEstimatedClassValues(dataset, indices).ToArray()).ToArray(); 69 double[] estimatedClassValueArr = estimatedClassValue.ToArray(); 70 double correctEstimated; 71 double[] confidences = new double[indices.Count()]; 72 73 for (int i = 0; i < indices.Count(); i++) { 74 correctEstimated = estimationsPerSolution.Where(x => DoubleExtensions.IsAlmost(x[i], estimatedClassValueArr[i])).Count(); 75 confidences[i] = (correctEstimated / (double)solutions.Count() - 0.5) * 2; 76 } 77 78 return confidences; 79 } 63 80 } 64 81 }
Note: See TracChangeset
for help on using the changeset viewer.