Changeset 5332
- Timestamp:
- 01/19/11 15:48:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationSolution.cs
r5323 r5332 111 111 double thresholdIncrement = (originalClasses[i] - originalClasses[i - 1]) / slices; 112 112 113 double bestThreshold = double.NaN; 113 double lowestBestThreshold = double.NaN; 114 double highestBestThreshold = double.NaN; 114 115 double bestClassificationScore = double.PositiveInfinity; 115 116 … … 130 131 else { 131 132 if (estimatedTarget.Key > lowerThreshold && estimatedTarget.Key < actualThreshold) 133 //false positive 132 134 classificationScore += ProblemData.MisclassificationMatrix[i - 1, i]; 133 135 else … … 138 140 if (classificationScore < bestClassificationScore) { 139 141 bestClassificationScore = classificationScore; 140 bestThreshold = actualThreshold; 141 } 142 lowestBestThreshold = actualThreshold; 143 highestBestThreshold = actualThreshold; 144 } else if (Math.Abs(classificationScore - bestClassificationScore) < double.Epsilon) 145 highestBestThreshold = actualThreshold; 146 142 147 actualThreshold += thresholdIncrement; 143 148 } 144 thresholds[i] = bestThreshold; 149 double falseNegativePenalty = ProblemData.MisclassificationMatrix[i, i - 1]; 150 double falsePositivePenalty = ProblemData.MisclassificationMatrix[i - 1, i]; 151 thresholds[i] = (lowestBestThreshold * falsePositivePenalty + highestBestThreshold * falseNegativePenalty) / (falseNegativePenalty + falsePositivePenalty); 145 152 } 146 153 this.optimalThresholds = new List<double>(thresholds);
Note: See TracChangeset
for help on using the changeset viewer.