Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/17/12 15:30:04 (12 years ago)
Author:
sforsten
Message:

#1776:

  • Corrected namespace of IClassificationEnsembleSolutionWeightCalculator interface
  • Corrected calculation of confidence for test and training samples in ClassificationEnsembleSolutionEstimatedClassValuesView
  • Added overload method GetConfidence to IClassificationEnsembleSolutionWeightCalculator to calculate more than one point at a time (maybe additional methods for training and test confidence could improve the performance remarkably)
  • Added ClassificationEnsembleSolutionConfidenceAccuracyDependence to see how accuracy would behave, if only samples with high confidence would be classified
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/ClassificationWeightCalculator.cs

    r7562 r8297  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using HeuristicLab.Problems.DataAnalysis.Interfaces.Classification;
     28using HeuristicLab.Problems.DataAnalysis.Interfaces;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis {
     
    124124    }
    125125
     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
    126144    #region Helper
    127145    protected IEnumerable<double> GetValues(IList<double> targetValues, IEnumerable<int> indizes) {
Note: See TracChangeset for help on using the changeset viewer.