Changeset 8680 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/NormalDistributionCutPointsThresholdCalculator.cs
 Timestamp:
 09/21/12 19:03:10 (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/NormalDistributionCutPointsThresholdCalculator.cs
r8658 r8680 162 162 } 163 163 164 private static double LogNormalDensity(double x, double mu, double sigma) {165 if (sigma.IsAlmost(0.0)) {166 if (x.IsAlmost(mu)) return 0.0; // log(1);167 else return double.NegativeInfinity;168 }169 170 return 0.5 * Math.Log(2.0 * Math.PI * sigma * sigma)  Math.Pow(x  mu, 2) / (2.0 * sigma * sigma);171 }172 173 164 private static void CalculateCutPoints(double m1, double s1, double m2, double s2, out double x1, out double x2) { 174 165 if (s1.IsAlmost(s2)) { … … 191 182 CalculateCutPoints(m2, s2, m1, s1, out x1, out x2); 192 183 } else { 193 // scale s1 and s2 for numeric stability194 //s2 = s2 / s1;195 //s1 = 1.0;196 184 double a = (s1 + s2) * (s1  s2); 197 185 double g = Math.Sqrt(s1 * s1 * s2 * s2 * ((m1  m2) * (m1  m2) + 2.0 * (s1 * s1 + s2 * s2) * Math.Log(s2 / s1)));
Note: See TracChangeset
for help on using the changeset viewer.