Changeset 712 for trunk/sources/HeuristicLab.GP.StructureIdentification/Evaluators/MeanSquaredErrorEvaluator.cs
- Timestamp:
- 11/05/08 21:34:12 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/Evaluators/MeanSquaredErrorEvaluator.cs
r702 r712 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 for (int sample = start; sample < end; sample++) {48 double original = dataset.GetValue( targetVariable, sample);47 for (int sample = start; sample < end; sample++) { 48 double original = dataset.GetValue(sample, targetVariable); 49 49 double estimated = evaluator.Evaluate(sample); 50 if (updateTargetValues) {51 dataset.SetValue( targetVariable, sample, estimated);50 if (updateTargetValues) { 51 dataset.SetValue(sample, targetVariable, estimated); 52 52 } 53 if (!double.IsNaN(original) && !double.IsInfinity(original)) {53 if (!double.IsNaN(original) && !double.IsInfinity(original)) { 54 54 double error = estimated - original; 55 55 errorsSquaredSum += error * error; … … 58 58 59 59 errorsSquaredSum /= (end - start); 60 if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) {60 if (double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) { 61 61 errorsSquaredSum = double.MaxValue; 62 62 } 63 63 64 64 DoubleData mse = GetVariableValue<DoubleData>("MSE", scope, false, false); 65 if (mse == null) {65 if (mse == null) { 66 66 mse = new DoubleData(); 67 67 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("MSE"), mse));
Note: See TracChangeset
for help on using the changeset viewer.