- Timestamp:
- 04/19/08 15:30:20 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/EarlyStoppingMeanSquaredErrorEvaluator.cs
r130 r136 34 34 public override string Description { 35 35 get { 36 return @"Evaluates 'OperatorTree' for samples 'FirstSampleIndex' - 'LastSampleIndex' (inclusive)and calculates the mean-squared-error36 return @"Evaluates 'OperatorTree' for all samples of the dataset and calculates the mean-squared-error 37 37 for the estimated values vs. the real values of 'TargetVariable'. 38 38 This operator stops the computation as soon as an upper limit for the mean-squared-error is reached."; … … 46 46 47 47 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; 49 49 double errorsSquaredSum = 0; 50 50 double targetMean = dataset.GetMean(targetVariable); … … 62 62 errorsSquaredSum += error * error; 63 63 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) 70 67 } 71 68 errorsSquaredSum /= dataset.Rows;
Note: See TracChangeset
for help on using the changeset viewer.