Changeset 1794 for trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/EarlyStoppingMeanSquaredErrorEvaluator.cs
- Timestamp:
- 05/14/09 09:34:08 (16 years ago)
- File:
-
- 1 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;
Note: See TracChangeset
for help on using the changeset viewer.