Changeset 1796 for trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/CoefficientOfDeterminationEvaluator.cs
- Timestamp:
- 05/14/09 13:46:57 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/CoefficientOfDeterminationEvaluator.cs
r712 r1796 42 42 } 43 43 44 public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {44 public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) { 45 45 double errorsSquaredSum = 0.0; 46 46 double originalDeviationTotalSumOfSquares = 0.0; 47 47 double targetMean = dataset.GetMean(targetVariable, start, end); 48 49 double originalSum = 0.0; 50 int n = 0; 48 51 for (int sample = start; sample < end; sample++) { 49 double estimated = evaluator.Evaluate( sample);52 double estimated = evaluator.Evaluate(tree, sample); 50 53 double original = dataset.GetValue(sample, targetVariable); 51 54 if (updateTargetValues) { … … 56 59 errorsSquaredSum += error * error; 57 60 58 double origDeviation = original - targetMean; 59 originalDeviationTotalSumOfSquares += origDeviation * origDeviation; 61 originalSum += original; 62 n++; 63 } 64 } 65 66 double originalMean = originalSum / n; 67 for(int sample = start; sample < end; sample++){ 68 double original = dataset.GetValue(sample, targetVariable); 69 if (!double.IsNaN(original) && !double.IsInfinity(original)) { 70 original = original - originalMean; 71 original = original * original; 72 originalDeviationTotalSumOfSquares += original; 60 73 } 61 74 }
Note: See TracChangeset
for help on using the changeset viewer.