Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/11 18:40:02 (14 years ago)
Author:
gkronber
Message:

#1418 fixed bug in threshold calculation and added missing wiring of model changed event in DiscriminantFunctionClassificationSolution.

File:
1 edited

Legend:

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

    r5809 r5849  
    100100
    101101        // determine class with maximal probability density in m
    102         double maxDensity = 0;
     102        double maxDensity = double.MinValue;
    103103        double maxDensityClassValue = -1;
    104104        foreach (var classValue in originalClasses) {
     
    136136
    137137    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      }
    139143    }
    140144
Note: See TracChangeset for help on using the changeset viewer.