Changeset 8297 for branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/ClassificationWeightCalculator.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/ClassificationWeightCalculator.cs
r7562 r8297 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Problems.DataAnalysis.Interfaces .Classification;28 using HeuristicLab.Problems.DataAnalysis.Interfaces; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis { … … 124 124 } 125 125 126 public virtual IEnumerable<double> GetConfidence(IEnumerable<IClassificationSolution> solutions, IEnumerable<int> indices, IEnumerable<double> estimatedClassValue) { 127 if (solutions.Count() < 1) 128 return Enumerable.Repeat(double.NaN, indices.Count()); 129 130 Dataset dataset = solutions.First().ProblemData.Dataset; 131 Dictionary<IClassificationSolution, double[]> solValues = solutions.ToDictionary(x => x, x => x.Model.GetEstimatedClassValues(dataset, indices).ToArray()); 132 double[] estimatedClassValueArr = estimatedClassValue.ToArray(); 133 double[] confidences = new double[indices.Count()]; 134 135 for (int i = 0; i < indices.Count(); i++) { 136 var correctSolutions = solValues.Where(x => DoubleExtensions.IsAlmost(x.Value[i], estimatedClassValueArr[i])); 137 confidences[i] = (from sol in correctSolutions 138 select weights[sol.Key]).Sum(); 139 } 140 141 return confidences; 142 } 143 126 144 #region Helper 127 145 protected IEnumerable<double> GetValues(IList<double> targetValues, IEnumerable<int> indizes) {
Note: See TracChangeset
for help on using the changeset viewer.