Changeset 8430 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators
- Timestamp:
- 08/08/12 14:04:17 (12 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab.TimeSeries-3.3
-
- Property svn:ignore
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 7921,7969,8113,8121,8126,8139,8151-8153,8167,8174,8246,8355
- Property svn:mergeinfo changed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/AccuracyMaximizationThresholdCalculator.cs
r7268 r8430 54 54 public static void CalculateThresholds(IClassificationProblemData problemData, IEnumerable<double> estimatedValues, IEnumerable<double> targetClassValues, out double[] classValues, out double[] thresholds) { 55 55 int slices = 100; 56 double minThresholdInc = 10e-5; // necessary to prevent infinite loop when maxEstimated - minEstimated is effectively zero (constant model) 56 57 List<double> estimatedValuesList = estimatedValues.ToList(); 57 58 double maxEstimatedValue = estimatedValuesList.Max(); 58 59 double minEstimatedValue = estimatedValuesList.Min(); 59 double thresholdIncrement = (maxEstimatedValue - minEstimatedValue) / slices;60 double thresholdIncrement = Math.Max((maxEstimatedValue - minEstimatedValue) / slices, minThresholdInc); 60 61 var estimatedAndTargetValuePairs = 61 62 estimatedValuesList.Zip(targetClassValues, (x, y) => new { EstimatedValue = x, TargetClassValue = y }) … … 70 71 71 72 // incrementally calculate accuracy of all possible thresholds 72 int[,] confusionMatrix = new int[nClasses, nClasses];73 74 73 for (int i = 1; i < thresholds.Length; i++) { 75 74 double lowerThreshold = thresholds[i - 1];
Note: See TracChangeset
for help on using the changeset viewer.