Changeset 137
- Timestamp:
- 04/19/08 15:36:02 (17 years ago)
- Location:
- branches/3.0/sources/HeuristicLab.StructureIdentification/Evaluation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/sources/HeuristicLab.StructureIdentification/Evaluation/EarlyStoppingMeanSquaredErrorEvaluator.cs
r130 r137 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; -
branches/3.0/sources/HeuristicLab.StructureIdentification/Evaluation/GPEvaluatorBase.cs
r128 r137 50 50 51 51 double result = Evaluate(scope, function, targetVariable, dataset); 52 scope.AddVariable(new HeuristicLab.Core.Variable( "Quality", new DoubleData(result)));52 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Quality"), new DoubleData(result))); 53 53 return null; 54 54 }
Note: See TracChangeset
for help on using the changeset viewer.