Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5341


Ignore:
Timestamp:
01/20/11 17:51:36 (14 years ago)
Author:
mkommend
Message:

Corrected minor flaw regarding equal classification scores during the calculation of the optimal thresholds (ticket #1383).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationSolution.cs

    r5332 r5341  
    114114        double highestBestThreshold = double.NaN;
    115115        double bestClassificationScore = double.PositiveInfinity;
     116        bool seriesOfEqualClassificationScores = false;
    116117
    117118        while (actualThreshold < originalClasses[i]) {
     
    138139            }
    139140          }
     141
     142          //new best classification score found
    140143          if (classificationScore < bestClassificationScore) {
    141144            bestClassificationScore = classificationScore;
    142145            lowestBestThreshold = actualThreshold;
    143146            highestBestThreshold = actualThreshold;
    144           } else if (Math.Abs(classificationScore - bestClassificationScore) < double.Epsilon)
     147            seriesOfEqualClassificationScores = true;
     148          }
     149            //equal classification scores => if seriesOfEqualClassifcationScores == true update highest threshold
     150          else if (Math.Abs(classificationScore - bestClassificationScore) < double.Epsilon && seriesOfEqualClassificationScores)
    145151            highestBestThreshold = actualThreshold;
     152          //worse classificatoin score found reset seriesOfEqualClassifcationScores
     153          else seriesOfEqualClassificationScores = false;
    146154
    147155          actualThreshold += thresholdIncrement;
    148156        }
     157        //scale lowest thresholds and highest found optimal threshold according to the misclassification matrix
    149158        double falseNegativePenalty = ProblemData.MisclassificationMatrix[i, i - 1];
    150159        double falsePositivePenalty = ProblemData.MisclassificationMatrix[i - 1, i];
Note: See TracChangeset for help on using the changeset viewer.