Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/11 13:47:28 (12 years ago)
Author:
sforsten
Message:

#1669: branch has been merged with the trunk in revision 7081 and methods in RegressionBenchmark have been renamed.

Location:
branches/RegressionBenchmarks
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/RegressionBenchmarks

  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis

  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs

    r5962 r7085  
    6363    #endregion
    6464
    65     public static double Calculate(IEnumerable<double> first, IEnumerable<double> second, out OnlineCalculatorError errorState) {
    66       IEnumerator<double> firstEnumerator = first.GetEnumerator();
    67       IEnumerator<double> secondEnumerator = second.GetEnumerator();
     65    public static double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, out OnlineCalculatorError errorState) {
     66      IEnumerator<double> originalEnumerator = originalValues.GetEnumerator();
     67      IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator();
    6868      OnlineNormalizedMeanSquaredErrorCalculator normalizedMSECalculator = new OnlineNormalizedMeanSquaredErrorCalculator();
    6969
    7070      //needed because otherwise the normalizedMSECalculator is in ErrorState.InsufficientValuesAdded
    71       if (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
    72         double estimated = secondEnumerator.Current;
    73         double original = firstEnumerator.Current;
     71      if (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) {
     72        double original = originalEnumerator.Current;
     73        double estimated = estimatedEnumerator.Current;
    7474        normalizedMSECalculator.Add(original, estimated);
    7575      }
    7676
    7777      // always move forward both enumerators (do not use short-circuit evaluation!)
    78       while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
    79         double estimated = secondEnumerator.Current;
    80         double original = firstEnumerator.Current;
     78      while (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) {
     79        double original = originalEnumerator.Current;
     80        double estimated = estimatedEnumerator.Current;
    8181        normalizedMSECalculator.Add(original, estimated);
    8282        if (normalizedMSECalculator.ErrorState != OnlineCalculatorError.None) break;
     
    8585      // check if both enumerators are at the end to make sure both enumerations have the same length
    8686      if (normalizedMSECalculator.ErrorState == OnlineCalculatorError.None &&
    87            (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    88         throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
     87           (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext())) {
     88        throw new ArgumentException("Number of elements in originalValues and estimatedValues enumeration doesn't match.");
    8989      } else {
    9090        errorState = normalizedMSECalculator.ErrorState;
Note: See TracChangeset for help on using the changeset viewer.