Changeset 5746 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs
- Timestamp:
- 03/18/11 09:57:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs
r5742 r5746 56 56 57 57 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 61 59 covEvaluator.Add(x, y); 62 60 sxEvaluator.Add(x); … … 65 63 66 64 #endregion 67 68 private static bool IsInvalidValue(double x) {69 return double.IsNaN(x) || double.IsInfinity(x);70 }71 65 72 66 public static double Calculate(IEnumerable<double> first, IEnumerable<double> second) { … … 79 73 double estimated = secondEnumerator.Current; 80 74 double original = firstEnumerator.Current; 81 if (!IsInvalidValue(estimated) && !IsInvalidValue(original)) 82 rSquaredEvaluator.Add(original, estimated); 75 rSquaredEvaluator.Add(original, estimated); 83 76 } 84 77
Note: See TracChangeset
for help on using the changeset viewer.