Changeset 5736 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators
- Timestamp:
- 03/17/11 15:14:45 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/AccuracyMaximizationThresholdCalculator.cs
r5730 r5736 69 69 classValues = problemData.ClassValues.OrderBy(x => x).ToArray(); 70 70 int nClasses = classValues.Length; 71 thresholds = new double[nClasses + 1];71 thresholds = new double[nClasses]; 72 72 thresholds[0] = double.NegativeInfinity; 73 thresholds[thresholds.Length - 1] = double.PositiveInfinity;73 // thresholds[thresholds.Length - 1] = double.PositiveInfinity; 74 74 75 75 // incrementally calculate accuracy of all possible thresholds 76 76 int[,] confusionMatrix = new int[nClasses, nClasses]; 77 77 78 for (int i = 1; i < thresholds.Length - 1; i++) {78 for (int i = 1; i < thresholds.Length; i++) { 79 79 double lowerThreshold = thresholds[i - 1]; 80 80 double actualThreshold = Math.Max(lowerThreshold, minEstimatedValue); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/NormalDistributionCutPointsThresholdCalculator.cs
r5730 r5736 88 88 thresholdList.Sort(); 89 89 thresholdList.Insert(0, double.NegativeInfinity); 90 thresholdList.Add(double.PositiveInfinity);91 90 92 91 // determine class values for each partition separated by a threshold by calculating the density of all class distributions 93 92 // all points in the partition are classified as the class with the maximal density in the parition 94 93 List<double> classValuesList = new List<double>(); 95 for (int i = 0; i < thresholdList.Count - 1; i++) {94 for (int i = 0; i < thresholdList.Count; i++) { 96 95 double m; 97 96 if (double.IsNegativeInfinity(thresholdList[i])) { 98 97 m = thresholdList[i + 1] - 1.0; // smaller than the smalles non-infinity threshold 99 } else if (double.IsPositiveInfinity(thresholdList[i + 1])) { 100 m = thresholdList[i] + 1.0; // larger than the largest non-infinity threshold 98 } else if (i == thresholdList.Count - 1) { 99 // last threshold 100 m = thresholdList[i] + 1.0; // larger than the last threshold 101 101 } else { 102 102 m = thresholdList[i] + (thresholdList[i + 1] - thresholdList[i]) / 2.0; // middle of partition … … 135 135 } 136 136 } 137 filteredThresholds.Add(double.PositiveInfinity);138 137 thresholds = filteredThresholds.ToArray(); 139 138 classValues = filteredClassValues.ToArray();
Note: See TracChangeset
for help on using the changeset viewer.