Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5845


Ignore:
Timestamp:
03/28/11 17:25:10 (14 years ago)
Author:
gkronber
Message:

#1453: changed OnlineEvaluators so that they do not throw an ArgumentException on receiving infinity of NaN values but instead return double.NaN as result.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineCovarianceEvaluator.cs

    r5809 r5845  
    5151    public void Add(double original, double estimated) {
    5252      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
    53           double.IsNaN(original) || double.IsInfinity(original)) {
    54         throw new ArgumentException("Covariance is not defined for series containing NaN or infinity elements");
     53          double.IsNaN(original) || double.IsInfinity(original) ||
     54         double.IsNaN(Cn)) {
     55        Cn = double.NaN;
    5556      } else {
    5657        n++;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs

    r5809 r5845  
    5050    public void Add(double original, double estimated) {
    5151      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
    52           double.IsNaN(original) || double.IsInfinity(original)) {
    53         throw new ArgumentException("Relative error is not defined for variables with NaN or infinity values.");
     52          double.IsNaN(original) || double.IsInfinity(original) ||
     53        double.IsNaN(sre)) {
     54        sre = double.NaN;
    5455      } else {
    5556        if (!original.IsAlmost(0.0)) {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAndVarianceCalculator.cs

    r5809 r5845  
    6060
    6161    public void Add(double x) {
    62       if (double.IsNaN(x) || double.IsInfinity(x)) {
    63         throw new ArgumentException("Mean and variance are not defined for NaN or infinity elements");
     62      if (double.IsNaN(x) || double.IsInfinity(x) || double.IsNaN(m_newM)) {
     63        m_newM = double.NaN;
     64        m_newS = double.NaN;
    6465      } else {
    6566        n++;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanSquaredErrorEvaluator.cs

    r5809 r5845  
    4949    public void Add(double original, double estimated) {
    5050      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
    51           double.IsNaN(original) || double.IsInfinity(original)) {
    52         throw new ArgumentException("Mean squared error is not defined for NaN or infinity elements");
     51          double.IsNaN(original) || double.IsInfinity(original) ||
     52        double.IsNaN(sse)) {
     53        sse = double.NaN;
    5354      } else {
    5455        double error = estimated - original;
Note: See TracChangeset for help on using the changeset viewer.