Free cookie consent management tool by TermsFeed Policy Generator

Changeset 478


Ignore:
Timestamp:
08/09/08 14:14:30 (16 years ago)
Author:
gkronber
Message:

fixed another small glitch in the classification evaluator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/ClassificationMeanSquaredErrorEvaluator.cs

    r476 r478  
    3333  public class ClassificationMeanSquaredErrorEvaluator : GPEvaluatorBase {
    3434    protected double[] backupValues;
     35    private const double EPSILON = 1.0E-6;
    3536    public override string Description {
    3637      get {
     
    6970        // on the lower end and upper end only add linear error if the absolute error is larger than 1
    7071        // the error>1.0 constraint is needed for balance because in the interval ]-1, 1[ the squared error is smaller than the absolute error
    71         if(error < -1.0 && original == classesArr[0] && estimated < classesArr[0] ||
    72           error > 1.0 && original == classesArr[classesArr.Length - 1] && estimated > classesArr[classesArr.Length - 1]) {
     72        if(error < -1.0 && IsEqual(original, classesArr[0]) && estimated < classesArr[0] ||
     73          error > 1.0 && IsEqual(original, classesArr[classesArr.Length - 1]) && estimated > classesArr[classesArr.Length - 1]) {
    7374          errorsSquaredSum += Math.Abs(error); // only add linear error below the smallest class or above the largest class
    7475        } else {
     
    8485      return errorsSquaredSum;
    8586    }
     87
     88    private bool IsEqual(double x, double y) {
     89      return Math.Abs(x - y) < EPSILON;
     90    }
    8691  }
    8792}
Note: See TracChangeset for help on using the changeset viewer.