Changeset 12839


Ignore:
Timestamp:
08/06/15 11:06:56 (4 years ago)
Author:
bburlacu
Message:

#2453: Ensure similarity value is never greater than 1 in the SymbolicExpressionTreePhenotypicSimilarityCalculator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreePhenotypicSimilarityCalculator.cs

    r12641 r12839  
    6767      var r = OnlinePearsonsRCalculator.Calculate(v1, v2, out error);
    6868
    69       if (r > 1.0)
    70         r = 1.0;
     69      var r2 = error == OnlineCalculatorError.None ? r * r : 0;
    7170
    72       return error == OnlineCalculatorError.None ? r*r : 0;
     71      if (r2 > 1.0)
     72        r2 = 1.0;
     73
     74      return r2;
    7375    }
    7476
     
    8991      var r = OnlinePearsonsRCalculator.Calculate(leftValues, rightValues, out error);
    9092
    91       if (r > 1.0)
    92         r = 1.0; // sometimes due to fp errors it can happen that the correlation is over 1 (like 1.0000000009)
     93      var r2 = error == OnlineCalculatorError.None ? r * r : 0;
    9394
    94       return error == OnlineCalculatorError.None ? r*r : 0;
     95      if (r2 > 1.0)
     96        r2 = 1.0;
     97
     98      return r2;
    9599    }
    96100  }
Note: See TracChangeset for help on using the changeset viewer.