Changeset 5849 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators
- Timestamp:
- 03/28/11 18:40:02 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/NormalDistributionCutPointsThresholdCalculator.cs
r5809 r5849 100 100 101 101 // determine class with maximal probability density in m 102 double maxDensity = 0;102 double maxDensity = double.MinValue; 103 103 double maxDensityClassValue = -1; 104 104 foreach (var classValue in originalClasses) { … … 136 136 137 137 private static double NormalDensity(double x, double mu, double sigma) { 138 return (1.0 / Math.Sqrt(2.0 * Math.PI * sigma * sigma)) * Math.Exp(-((x - mu) * (x - mu)) / (2.0 * sigma * sigma)); 138 if (sigma.IsAlmost(0.0)) { 139 if (x.IsAlmost(mu)) return 1.0; else return 0.0; 140 } else { 141 return (1.0 / Math.Sqrt(2.0 * Math.PI * sigma * sigma)) * Math.Exp(-((x - mu) * (x - mu)) / (2.0 * sigma * sigma)); 142 } 139 143 } 140 144
Note: See TracChangeset
for help on using the changeset viewer.