Free cookie consent management tool by TermsFeed Policy Generator

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

Fixed incorrect evaluation in MSE evaluators when the original values contain NaNs. #615 (Evaluation of HL3 function trees should be equivalent to evaluation in HL2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/EarlyStoppingMeanSquaredErrorEvaluator.cs

    r712 r1794  
    5454      double errorsSquaredSum = 0;
    5555      int rows = end - start;
     56      int n = 0;
    5657      for (int sample = start; sample < end; sample++) {
    5758        double estimated = evaluator.Evaluate(sample);
     
    6364          double error = estimated - original;
    6465          errorsSquaredSum += error * error;
     66          n++;
    6567        }
    6668        // check the limit and stop as soon as we hit the limit
    6769        if (errorsSquaredSum / rows >= qualityLimit) {
    68           mse.Data = errorsSquaredSum / (sample - start + 1); // return estimated MSE (when the remaining errors are on average the same)
     70          mse.Data = errorsSquaredSum / (n + 1); // return estimated MSE (when the remaining errors are on average the same)
    6971          return;
    7072        }
    7173      }
    72       errorsSquaredSum /= rows;
     74      errorsSquaredSum /= n;
    7375      if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) {
    7476        errorsSquaredSum = double.MaxValue;
Note: See TracChangeset for help on using the changeset viewer.