Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/04/11 18:09:49 (14 years ago)
Author:
mkommend
Message:

#1453: Stopped iterating over the enumerables in the static calculate method in OnlineCalculators.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineAccuracyCalculator.cs

    r5943 r5945  
    7878        double original = firstEnumerator.Current;
    7979        accuracyCalculator.Add(original, estimated);
     80        if (accuracyCalculator.ErrorState != OnlineCalculatorError.None) break;
    8081      }
    8182
    8283      // check if both enumerators are at the end to make sure both enumerations have the same length
    83       if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     84      if (accuracyCalculator.ErrorState == OnlineCalculatorError.None &&
     85          (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    8486        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
    8587      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalcualtor.cs

    r5943 r5945  
    8282        double original = firstEnumerator.Current;
    8383        covarianceCalculator.Add(original, estimated);
     84        if (covarianceCalculator.ErrorState != OnlineCalculatorError.None) break;
    8485      }
    8586
    8687      // check if both enumerators are at the end to make sure both enumerations have the same length
    87       if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     88      if (covarianceCalculator.ErrorState == OnlineCalculatorError.None &&
     89          (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    8890        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
    8991      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs

    r5943 r5945  
    107107        double targetElement = targetEnumerator.Current;
    108108        calculator.Add(originalElement, targetElement);
     109        if (calculator.ErrorState != OnlineCalculatorError.None) break;
    109110      }
    110111
    111112      // check if both enumerators are at the end to make sure both enumerations have the same length
    112       if (originalEnumerator.MoveNext() || targetEnumerator.MoveNext()) {
     113      if (calculator.ErrorState == OnlineCalculatorError.None &&
     114            (originalEnumerator.MoveNext() || targetEnumerator.MoveNext())) {
    113115        throw new ArgumentException("Number of elements in original and target enumeration do not match.");
    114116      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs

    r5943 r5945  
    7777        double original = firstEnumerator.Current;
    7878        calculator.Add(original, estimated);
     79        if (calculator.ErrorState != OnlineCalculatorError.None) break;
    7980      }
    8081
    8182      // check if both enumerators are at the end to make sure both enumerations have the same length
    82       if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     83      if (calculator.ErrorState == OnlineCalculatorError.None &&
     84            (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    8385        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
    8486      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs

    r5943 r5945  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs

    r5943 r5945  
    7575        double original = firstEnumerator.Current;
    7676        mseCalculator.Add(original, estimated);
     77        if (mseCalculator.ErrorState != OnlineCalculatorError.None) break;
    7778      }
    7879
    7980      // check if both enumerators are at the end to make sure both enumerations have the same length
    80       if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     81      if (mseCalculator.ErrorState == OnlineCalculatorError.None &&
     82         (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    8183        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
    8284      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs

    r5943 r5945  
    7373        double original = firstEnumerator.Current;
    7474        normalizedMSECalculator.Add(original, estimated);
     75        if (normalizedMSECalculator.ErrorState != OnlineCalculatorError.None) break;
    7576      }
    7677
    7778      // check if both enumerators are at the end to make sure both enumerations have the same length
    78       if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     79      if (normalizedMSECalculator.ErrorState == OnlineCalculatorError.None &&
     80           (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    7981        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
    8082      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs

    r5943 r5945  
    7777        double original = firstEnumerator.Current;
    7878        rSquaredCalculator.Add(original, estimated);
     79        if (rSquaredCalculator.ErrorState != OnlineCalculatorError.None) break;
    7980      }
    8081
    8182      // check if both enumerators are at the end to make sure both enumerations have the same length
    82       if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     83      if (rSquaredCalculator.ErrorState == OnlineCalculatorError.None &&
     84           (secondEnumerator.MoveNext() || firstEnumerator.MoveNext())) {
    8385        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
    8486      } else {
Note: See TracChangeset for help on using the changeset viewer.