Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/13/15 21:19:15 (9 years ago)
Author:
gkronber
Message:

#1998: merged changes from trunk to stable branch

Location:
stable
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationPerformanceMeasures.cs

    r12009 r13156  
    3737    protected const string TrainingFalsePositiveRateResultName = "False positive rate (training)";
    3838    protected const string TrainingFalseDiscoveryRateResultName = "False discovery rate (training)";
     39    protected const string TrainingF1ScoreResultName = "F1 score (training)";
     40    protected const string TrainingMatthewsCorrelationResultName = "Matthews Correlation (training)";
    3941    protected const string TestTruePositiveRateResultName = "True positive rate (test)";
    4042    protected const string TestTrueNegativeRateResultName = "True negative rate (test)";
     
    4345    protected const string TestFalsePositiveRateResultName = "False positive rate (test)";
    4446    protected const string TestFalseDiscoveryRateResultName = "False discovery rate (test)";
     47    protected const string TestF1ScoreResultName = "F1 score (test)";
     48    protected const string TestMatthewsCorrelationResultName = "Matthews Correlation (test)";
    4549    #endregion
    4650
     
    8993      set { ((DoubleValue)this[TrainingFalseDiscoveryRateResultName].Value).Value = value; }
    9094    }
     95    public double TrainingF1Score {
     96      get { return ((DoubleValue)this[TrainingF1ScoreResultName].Value).Value; }
     97      set { ((DoubleValue)this[TrainingF1ScoreResultName].Value).Value = value; }
     98    }
     99    public double TrainingMatthewsCorrelation {
     100      get { return ((DoubleValue)this[TrainingMatthewsCorrelationResultName].Value).Value; }
     101      set { ((DoubleValue)this[TrainingMatthewsCorrelationResultName].Value).Value = value; }
     102    }
    91103    public double TestTruePositiveRate {
    92104      get { return ((DoubleValue)this[TestTruePositiveRateResultName].Value).Value; }
     
    113125      set { ((DoubleValue)this[TestFalseDiscoveryRateResultName].Value).Value = value; }
    114126    }
     127    public double TestF1Score {
     128      get { return ((DoubleValue)this[TestF1ScoreResultName].Value).Value; }
     129      set { ((DoubleValue)this[TestF1ScoreResultName].Value).Value = value; }
     130    }
     131    public double TestMatthewsCorrelation {
     132      get { return ((DoubleValue)this[TestMatthewsCorrelationResultName].Value).Value; }
     133      set { ((DoubleValue)this[TestMatthewsCorrelationResultName].Value).Value = value; }
     134    }
    115135    #endregion
    116136
     
    123143      Add(new Result(TrainingFalsePositiveRateResultName, "The false positive rate is the complement of the true negative rate of the model on the training partition.", new PercentValue()));
    124144      Add(new Result(TrainingFalseDiscoveryRateResultName, "The false discovery rate is the complement of the positive predictive value of the model on the training partition.", new PercentValue()));
     145      Add(new Result(TrainingF1ScoreResultName, "The F1 score of the model on the training partition.", new DoubleValue()));
     146      Add(new Result(TrainingMatthewsCorrelationResultName, "The Matthews correlation value of the model on the training partition.", new DoubleValue()));
    125147      Add(new Result(TestTruePositiveRateResultName, "Sensitivity/True positive rate of the model on the test partition\n(TP/(TP+FN)).", new PercentValue()));
    126148      Add(new Result(TestTrueNegativeRateResultName, "Specificity/True negative rate of the model on the test partition\n(TN/(FP+TN)).", new PercentValue()));
     
    129151      Add(new Result(TestFalsePositiveRateResultName, "The false positive rate is the complement of the true negative rate of the model on the test partition.", new PercentValue()));
    130152      Add(new Result(TestFalseDiscoveryRateResultName, "The false discovery rate is the complement of the positive predictive value of the model on the test partition.", new PercentValue()));
     153      Add(new Result(TestF1ScoreResultName, "The F1 score of the model on the test partition.", new DoubleValue()));
     154      Add(new Result(TestMatthewsCorrelationResultName, "The Matthews correlation value of the model on the test partition.", new DoubleValue()));
    131155      TrainingTruePositiveRate = double.NaN;
    132156      TrainingTrueNegativeRate = double.NaN;
     
    135159      TrainingFalsePositiveRate = double.NaN;
    136160      TrainingFalseDiscoveryRate = double.NaN;
     161      TrainingF1Score = double.NaN;
     162      TrainingMatthewsCorrelation = double.NaN;
    137163      TestTruePositiveRate = double.NaN;
    138164      TestTrueNegativeRate = double.NaN;
     
    141167      TestFalsePositiveRate = double.NaN;
    142168      TestFalseDiscoveryRate = double.NaN;
     169      TestF1Score = double.NaN;
     170      TestMatthewsCorrelation = double.NaN;
    143171    }
    144172
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs

    r12009 r13156  
    2626using HeuristicLab.Optimization;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Problems.DataAnalysis.OnlineCalculators;
    2829
    2930namespace HeuristicLab.Problems.DataAnalysis {
     
    135136      if (testPerformanceCalculator.ErrorState == OnlineCalculatorError.None)
    136137        ClassificationPerformanceMeasures.SetTestResults(testPerformanceCalculator);
     138
     139      if (ProblemData.Classes == 2) {
     140        var f1Training = FOneScoreCalculator.Calculate(originalTrainingClassValues, estimatedTrainingClassValues, out errorState);
     141        if (errorState == OnlineCalculatorError.None) ClassificationPerformanceMeasures.TrainingF1Score = f1Training;
     142        var f1Test = FOneScoreCalculator.Calculate(originalTestClassValues, estimatedTestClassValues, out errorState);
     143        if (errorState == OnlineCalculatorError.None) ClassificationPerformanceMeasures.TestF1Score = f1Test;
     144      }
     145
     146      var mccTraining = MatthewsCorrelationCoefficientCalculator.Calculate(originalTrainingClassValues, estimatedTrainingClassValues, out errorState);
     147      if (errorState == OnlineCalculatorError.None) ClassificationPerformanceMeasures.TrainingMatthewsCorrelation = mccTraining;
     148      var mccTest = MatthewsCorrelationCoefficientCalculator.Calculate(originalTestClassValues, estimatedTestClassValues, out errorState);
     149      if (errorState == OnlineCalculatorError.None) ClassificationPerformanceMeasures.TestMatthewsCorrelation = mccTest;
    137150    }
    138151
Note: See TracChangeset for help on using the changeset viewer.