Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/11 00:59:36 (14 years ago)
Author:
mkommend
Message:

#1418: Added all single objective symbolic regression analyzers.

File:
1 edited

Legend:

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

    r5490 r5500  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using HeuristicLab.Common;
    2425
     
    6869      return double.IsNaN(x) || double.IsInfinity(x);
    6970    }
     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    }
    7089  }
    7190}
Note: See TracChangeset for help on using the changeset viewer.