Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8680


Ignore:
Timestamp:
09/21/12 19:03:10 (12 years ago)
Author:
gkronber
Message:

#1925 : minor code improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/NormalDistributionCutPointsThresholdCalculator.cs

    r8658 r8680  
    162162    }
    163163
    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 
    173164    private static void CalculateCutPoints(double m1, double s1, double m2, double s2, out double x1, out double x2) {
    174165      if (s1.IsAlmost(s2)) {
     
    191182          CalculateCutPoints(m2, s2, m1, s1, out x1, out x2);
    192183        } else {
    193           // scale s1 and s2 for numeric stability
    194           //s2 = s2 / s1;
    195           //s1 = 1.0;
    196184          double a = (s1 + s2) * (s1 - s2);
    197185          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.