Free cookie consent management tool by TermsFeed Policy Generator

Changeset 136


Ignore:
Timestamp:
04/19/08 15:30:20 (17 years ago)
Author:
gkronber
Message:

fixed a bug in the MSE evaluator which uses an early stopping criterion.
(ticket #29)

File:
1 edited

Legend:

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

    r130 r136  
    3434    public override string Description {
    3535      get {
    36         return @"Evaluates 'OperatorTree' for samples 'FirstSampleIndex' - 'LastSampleIndex' (inclusive) and calculates the mean-squared-error
     36        return @"Evaluates 'OperatorTree' for all samples of the dataset and calculates the mean-squared-error
    3737for the estimated values vs. the real values of 'TargetVariable'.
    3838This operator stops the computation as soon as an upper limit for the mean-squared-error is reached.";
     
    4646
    4747    public override double Evaluate(IScope scope, IFunction function, int targetVariable, Dataset dataset) {
    48       double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, true).Data;
     48      double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, false).Data;
    4949      double errorsSquaredSum = 0;
    5050      double targetMean = dataset.GetMean(targetVariable);
     
    6262        errorsSquaredSum += error * error;
    6363
    64         // check the limit every 10 samples and stop as soon as we hit the limit
    65         if(sample % 10 == 9)
    66           if(qualityLimit < errorsSquaredSum / dataset.Rows ||
    67             double.IsNaN(errorsSquaredSum) ||
    68             double.IsInfinity(errorsSquaredSum))
    69             return errorsSquaredSum / sample; // return estimated MSE (when the remaining errors are on average the same)
     64        // check the limit and stop as soon as we hit the limit
     65        if(errorsSquaredSum / dataset.Rows >= qualityLimit)
     66          return errorsSquaredSum / (sample+1); // return estimated MSE (when the remaining errors are on average the same)
    7067      }
    7168      errorsSquaredSum /= dataset.Rows;
Note: See TracChangeset for help on using the changeset viewer.