- Timestamp:
- 05/14/09 09:34:08 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/EarlyStoppingMeanSquaredErrorEvaluator.cs
r712 r1794 54 54 double errorsSquaredSum = 0; 55 55 int rows = end - start; 56 int n = 0; 56 57 for (int sample = start; sample < end; sample++) { 57 58 double estimated = evaluator.Evaluate(sample); … … 63 64 double error = estimated - original; 64 65 errorsSquaredSum += error * error; 66 n++; 65 67 } 66 68 // check the limit and stop as soon as we hit the limit 67 69 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) 69 71 return; 70 72 } 71 73 } 72 errorsSquaredSum /= rows;74 errorsSquaredSum /= n; 73 75 if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) { 74 76 errorsSquaredSum = double.MaxValue; -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/MeanSquaredErrorEvaluator.cs
r712 r1794 45 45 public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) { 46 46 double errorsSquaredSum = 0; 47 int n = 0; 47 48 for (int sample = start; sample < end; sample++) { 48 49 double original = dataset.GetValue(sample, targetVariable); … … 54 55 double error = estimated - original; 55 56 errorsSquaredSum += error * error; 57 n++; 56 58 } 57 59 } 58 60 59 errorsSquaredSum /= (end - start);61 errorsSquaredSum /= n; 60 62 if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) { 61 63 errorsSquaredSum = double.MaxValue;
Note: See TracChangeset
for help on using the changeset viewer.