Changeset 11685


Ignore:
Timestamp:
12/16/14 12:09:48 (8 years ago)
Author:
ehopf
Message:

#2278: improvements on the classification performance measures encapsulation

Location:
branches/Classification-Extensions/HeuristicLab.Problems.DataAnalysis/3.4
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/Classification-Extensions/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r11684 r11685  
    175175    </Compile>
    176176    <Compile Include="Implementation\Classification\ClassificationEnsembleSolution.cs" />
    177     <Compile Include="Implementation\Classification\ClassificationPerformanceMeasuresResultCollection.cs" />
     177    <Compile Include="Implementation\Classification\ClassificationPerformanceMeasures.cs" />
    178178    <Compile Include="Implementation\Classification\ClassificationProblemData.cs" />
    179179    <Compile Include="Implementation\Classification\ClassificationProblem.cs" />
  • branches/Classification-Extensions/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs

    r11684 r11685  
    108108      var positiveClassName = ProblemData.PositiveClassName;
    109109      double positiveClassValue = ProblemData.GetClassValue(positiveClassName);
    110       ClassificationPerformanceMeasures.ClassificationPositiveClassValue = positiveClassName;
    111       ClassificationPerformanceMeasuresCalculator trainingPerformanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassValue);
    112       ClassificationPerformanceMeasuresCalculator testPerformanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassValue);
     110      ClassificationPerformanceMeasuresCalculator trainingPerformanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassName, positiveClassValue);
     111      ClassificationPerformanceMeasuresCalculator testPerformanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassName, positiveClassValue);
    113112
    114113      OnlineCalculatorError errorState;
     
    130129
    131130      trainingPerformanceCalculator.Calculate(originalTrainingClassValues, estimatedTrainingClassValues, out errorState);
    132       if (errorState == OnlineCalculatorError.None) {
    133         ClassificationPerformanceMeasures.TrainingTruePositiveRate = trainingPerformanceCalculator.TruePositiveRate;
    134         ClassificationPerformanceMeasures.TrainingTrueNegativeRate = trainingPerformanceCalculator.TrueNegativeRate;
    135         ClassificationPerformanceMeasures.TrainingPositivePredictiveValue = trainingPerformanceCalculator.PositivePredictiveValue;
    136         ClassificationPerformanceMeasures.TrainingNegativePredictiveValue = trainingPerformanceCalculator.NegativePredictiveValue;
    137         ClassificationPerformanceMeasures.TrainingFalsePositiveRate = trainingPerformanceCalculator.FalsePositiveRate;
    138         ClassificationPerformanceMeasures.TrainingFalseDiscoveryRate = trainingPerformanceCalculator.FalseDiscoveryRate;
    139       }
     131      if (errorState == OnlineCalculatorError.None)
     132        ClassificationPerformanceMeasures.SetTrainingResults(trainingPerformanceCalculator);
    140133      testPerformanceCalculator.Calculate(originalTestClassValues, estimatedTestClassValues, out errorState);
    141       if (errorState == OnlineCalculatorError.None) {
    142         ClassificationPerformanceMeasures.TestTruePositiveRate = testPerformanceCalculator.TruePositiveRate;
    143         ClassificationPerformanceMeasures.TestTrueNegativeRate = testPerformanceCalculator.TrueNegativeRate;
    144         ClassificationPerformanceMeasures.TestPositivePredictiveValue = testPerformanceCalculator.PositivePredictiveValue;
    145         ClassificationPerformanceMeasures.TestNegativePredictiveValue = testPerformanceCalculator.NegativePredictiveValue;
    146         ClassificationPerformanceMeasures.TestFalsePositiveRate = testPerformanceCalculator.FalsePositiveRate;
    147         ClassificationPerformanceMeasures.TestFalseDiscoveryRate = testPerformanceCalculator.FalseDiscoveryRate;
    148       }
     134      if (errorState == OnlineCalculatorError.None)
     135        ClassificationPerformanceMeasures.SetTestResults(testPerformanceCalculator);
    149136    }
    150137
  • branches/Classification-Extensions/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ClassificationPerformanceMeasuresCalculator.cs

    r11683 r11685  
    2929  public class ClassificationPerformanceMeasuresCalculator {
    3030
    31     public ClassificationPerformanceMeasuresCalculator(double positiveClassValue) {
     31    public ClassificationPerformanceMeasuresCalculator(string positiveClassName, double positiveClassValue) {
     32      this.positiveClassName = positiveClassName;
    3233      this.positiveClassValue = positiveClassValue;
    3334      Reset();       
     
    3536
    3637    #region Properties
     38    private string positiveClassName;
    3739    private double positiveClassValue;
    3840    private int truePositiveCount, falsePositiveCount, trueNegativeCount, falseNegativeCount;
    3941
     42    public string PositiveClassName {
     43      get {
     44        return positiveClassName;
     45      }
     46    }
     47    public double PositiveClassValue {
     48      get {
     49        return positiveClassValue;
     50      }
     51    }
    4052    public double TruePositiveRate {
    4153      get {
Note: See TracChangeset for help on using the changeset viewer.