Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/09 17:12:37 (15 years ago)
Author:
gkronber
Message:

Improved handling of exceptional cases in data-based modeling evaluators. #688 (SimpleEvaluators should handle exceptional cases more gracefully)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleMSEEvaluator.cs

    r1888 r2136  
    1616    }
    1717    public override double Evaluate(double[,] values) {
    18       return Calculate(values);
     18      try {
     19        return Calculate(values);
     20      }
     21      catch (ArgumentException) {
     22        return double.PositiveInfinity;
     23      }
    1924    }
    2025
     
    3237        }
    3338      }
    34 
    35       double mse = sse / cnt;
    36       return mse;
     39      if (cnt > 0) {
     40        double mse = sse / cnt;
     41        return mse;
     42      } else {
     43        throw new ArgumentException("Mean squared errors is not defined for input vectors of NaN or Inf");
     44      }
    3745    }
    3846  }
Note: See TracChangeset for help on using the changeset viewer.