Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/30/11 18:04:03 (14 years ago)
Author:
gkronber
Message:

#1453: Added an ErrorState property to online evaluators to indicate if the result value is valid or if there has been an error in the calculation. Adapted all classes that use one of the online evaluators to check this property.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs

    r5809 r5894  
    114114      IEnumerable<double> originalTestValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TestIndizes);
    115115
    116       double trainingMSE = OnlineMeanSquaredErrorEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues);
    117       double testMSE = OnlineMeanSquaredErrorEvaluator.Calculate(estimatedTestValues, originalTestValues);
    118       double trainingR2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues);
    119       double testR2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedTestValues, originalTestValues);
    120       double trainingRelError = OnlineMeanAbsolutePercentageErrorEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues);
    121       double testRelError = OnlineMeanAbsolutePercentageErrorEvaluator.Calculate(estimatedTestValues, originalTestValues);
     116      OnlineEvaluatorError errorState;
     117      double trainingMSE = OnlineMeanSquaredErrorEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
     118      TrainingMeanSquaredError = errorState == OnlineEvaluatorError.None ? trainingMSE : double.NaN;
     119      double testMSE = OnlineMeanSquaredErrorEvaluator.Calculate(estimatedTestValues, originalTestValues, out errorState);
     120      TestMeanSquaredError = errorState == OnlineEvaluatorError.None ? testMSE : double.NaN;
    122121
    123       TrainingMeanSquaredError = trainingMSE;
    124       TestMeanSquaredError = testMSE;
    125       TrainingRSquared = trainingR2;
    126       TestRSquared = testR2;
    127       TrainingRelativeError = trainingRelError;
    128       TestRelativeError = testRelError;
     122      double trainingR2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
     123      TrainingRSquared = errorState == OnlineEvaluatorError.None ? trainingR2 : double.NaN;
     124      double testR2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedTestValues, originalTestValues, out errorState);
     125      TestRSquared = errorState == OnlineEvaluatorError.None ? testR2 : double.NaN;
     126
     127      double trainingRelError = OnlineMeanAbsolutePercentageErrorEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
     128      TrainingRelativeError = errorState == OnlineEvaluatorError.None ? trainingRelError : double.NaN;
     129      double testRelError = OnlineMeanAbsolutePercentageErrorEvaluator.Calculate(estimatedTestValues, originalTestValues, out errorState);
     130      TestRelativeError = errorState == OnlineEvaluatorError.None ? testRelError : double.NaN;
    129131    }
    130132
Note: See TracChangeset for help on using the changeset viewer.