Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/18/11 09:57:44 (13 years ago)
Author:
gkronber
Message:

#1418 bug fixes and minor changes to improve performance in online evaluators.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs

    r5742 r5746  
    5656
    5757    public void Add(double x, double y) {
    58       if (IsInvalidValue(x) || IsInvalidValue(y)) {
    59         throw new ArgumentException("R² is not defined for variables with NaN or infinity values.");
    60       }
     58      // no need to check validity of values explicitly here as it is checked in all three evaluators
    6159      covEvaluator.Add(x, y);
    6260      sxEvaluator.Add(x);
     
    6563
    6664    #endregion
    67 
    68     private static bool IsInvalidValue(double x) {
    69       return double.IsNaN(x) || double.IsInfinity(x);
    70     }
    7165
    7266    public static double Calculate(IEnumerable<double> first, IEnumerable<double> second) {
     
    7973        double estimated = secondEnumerator.Current;
    8074        double original = firstEnumerator.Current;
    81         if (!IsInvalidValue(estimated) && !IsInvalidValue(original))
    82           rSquaredEvaluator.Add(original, estimated);
     75        rSquaredEvaluator.Add(original, estimated);
    8376      }
    8477
Note: See TracChangeset for help on using the changeset viewer.