Changeset 5500 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs
- Timestamp:
- 02/17/11 00:59:36 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs
r5490 r5500 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 … … 68 69 return double.IsNaN(x) || double.IsInfinity(x); 69 70 } 71 72 public static double Calculate(IEnumerable<double> first, IEnumerable<double> second) { 73 IEnumerator<double> firstEnumerator = first.GetEnumerator(); 74 IEnumerator<double> secondEnumerator = second.GetEnumerator(); 75 OnlinePearsonsRSquaredEvaluator rSquaredEvaluator = new OnlinePearsonsRSquaredEvaluator(); 76 77 while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) { 78 double estimated = secondEnumerator.Current; 79 double original = firstEnumerator.Current; 80 rSquaredEvaluator.Add(original, estimated); 81 } 82 83 if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) { 84 throw new ArgumentException("Number of elements in first and second enumeration doesn't match."); 85 } else { 86 return rSquaredEvaluator.RSquared; 87 } 88 } 70 89 } 71 90 }
Note: See TracChangeset
for help on using the changeset viewer.