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/MeanSquaredErrorEvaluator.cs

    r712 r1794  
    4545    public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4646      double errorsSquaredSum = 0;
     47      int n = 0;
    4748      for (int sample = start; sample < end; sample++) {
    4849        double original = dataset.GetValue(sample, targetVariable);
     
    5455          double error = estimated - original;
    5556          errorsSquaredSum += error * error;
     57          n++;
    5658        }
    5759      }
    5860
    59       errorsSquaredSum /= (end - start);
     61      errorsSquaredSum /= n;
    6062      if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) {
    6163        errorsSquaredSum = double.MaxValue;
Note: See TracChangeset for help on using the changeset viewer.