Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4233 for branches


Ignore:
Timestamp:
08/16/10 19:17:13 (14 years ago)
Author:
gkronber
Message:

Added operator to apply covariant parsimony pressure. #1142

Location:
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/OnlineCovarianceEvaluator.cs

    r4068 r4233  
    2525  public class OnlineCovarianceEvaluator : IOnlineEvaluator {
    2626
    27     private double originalMean, estimatedMean, Cn;
     27    private double xMean, yMean, Cn;
    2828    private int n;
    2929    public double Covariance {
     
    4747      n = 0;
    4848      Cn = 0.0;
    49       originalMean = 0.0;
    50       estimatedMean = 0.0;
     49      xMean = 0.0;
     50      yMean = 0.0;
    5151    }
    5252
    53     public void Add(double original, double estimated) {
    54       if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
    55           double.IsNaN(original) || double.IsInfinity(original)) {
     53    public void Add(double x, double y) {
     54      if (double.IsNaN(x) || double.IsInfinity(x) ||
     55          double.IsNaN(y) || double.IsInfinity(y)) {
    5656        throw new ArgumentException("Covariance is not defined for series containing NaN or infinity elements");
    5757      } else {
    5858        n++;
    5959        // online calculation of tMean
    60         originalMean = originalMean + (original - originalMean) / n;
    61         double delta = estimated - estimatedMean; // delta = (y - yMean(n-1))
    62         estimatedMean = estimatedMean + delta / n;
     60
     61        xMean = xMean + (x - xMean) / n;
     62        double deltaY = y - yMean; // delta = (y - yMean(n-1))
     63        yMean = yMean + deltaY / n;
    6364
    6465        // online calculation of covariance
    65         Cn = Cn + delta * (original - originalMean); // C(n) = C(n-1) + (y - yMean(n-1)) (t - tMean(n))       
     66        Cn = Cn + deltaY * (x - xMean); // C(n) = C(n-1) + (y - yMean(n-1)) (x - xMean(n))
    6667      }
    6768    }
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj

    r4221 r4233  
    133133    <Compile Include="Interfaces\IOnlineEvaluator.cs" />
    134134    <Compile Include="MatrixExtensions.cs" />
     135    <Compile Include="Operators\CovariantParsimonyPressure.cs" />
    135136    <Compile Include="Operators\DynamicDepthLimitInitializer.cs" />
    136137    <Compile Include="Operators\DynOpEqHistogramInitializer.cs" />
Note: See TracChangeset for help on using the changeset viewer.