Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/11 15:03:46 (14 years ago)
Author:
gkronber
Message:

Merged changes from trunk to data analysis exploration branch and added fractional distance metric evaluator. #1142

Location:
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators
Files:
8 edited

Legend:

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

    r4233 r5275  
    2525  public class OnlineCovarianceEvaluator : IOnlineEvaluator {
    2626
    27     private double xMean, yMean, Cn;
     27    private double originalMean, estimatedMean, Cn;
    2828    private int n;
    2929    public double Covariance {
     
    4747      n = 0;
    4848      Cn = 0.0;
    49       xMean = 0.0;
    50       yMean = 0.0;
     49      originalMean = 0.0;
     50      estimatedMean = 0.0;
    5151    }
    5252
    53     public void Add(double x, double y) {
    54       if (double.IsNaN(x) || double.IsInfinity(x) ||
    55           double.IsNaN(y) || double.IsInfinity(y)) {
     53    public void Add(double original, double estimated) {
     54      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
     55          double.IsNaN(original) || double.IsInfinity(original)) {
    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 
    61         xMean = xMean + (x - xMean) / n;
    62         double deltaY = y - yMean; // delta = (y - yMean(n-1))
    63         yMean = yMean + deltaY / n;
     60        originalMean = originalMean + (original - originalMean) / n;
     61        double delta = estimated - estimatedMean; // delta = (y - yMean(n-1))
     62        estimatedMean = estimatedMean + delta / n;
    6463
    6564        // online calculation of covariance
    66         Cn = Cn + deltaY * (x - xMean); // C(n) = C(n-1) + (y - yMean(n-1)) (x - xMean(n))
     65        Cn = Cn + delta * (original - originalMean); // C(n) = C(n-1) + (y - yMean(n-1)) (t - tMean(n))       
    6766      }
    6867    }
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleEvaluator.cs

    r4068 r5275  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
    2425using HeuristicLab.Operators;
    2526using HeuristicLab.Parameters;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3234    public ILookupParameter<DoubleMatrix> ValuesParameter {
    3335      get { return (ILookupParameter<DoubleMatrix>)Parameters["Values"]; }
     36    }
     37    [StorableConstructor]
     38    protected SimpleEvaluator(bool deserializing) : base(deserializing) { }
     39    protected SimpleEvaluator(SimpleEvaluator original, Cloner cloner)
     40      : base(original, cloner) {
    3441    }
    3542    public SimpleEvaluator()
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs

    r4341 r5275  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3436    }
    3537
     38    [StorableConstructor]
     39    protected SimpleMSEEvaluator(bool deserializing) : base(deserializing) { }
     40    protected SimpleMSEEvaluator(SimpleMSEEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new SimpleMSEEvaluator(this, cloner);
     45    }
    3646    public SimpleMSEEvaluator() {
    3747      Parameters.Add(new LookupParameter<DoubleValue>("MeanSquaredError", "The mean squared error of estimated values."));
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageErrorEvaluator.cs

    r4068 r5275  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3335    }
    3436
     37    [StorableConstructor]
     38    protected SimpleMeanAbsolutePercentageErrorEvaluator(bool deserializing) : base(deserializing) { }
     39    protected SimpleMeanAbsolutePercentageErrorEvaluator(SimpleMeanAbsolutePercentageErrorEvaluator original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
    3542    public SimpleMeanAbsolutePercentageErrorEvaluator() {
    3643      Parameters.Add(new LookupParameter<PercentValue>("AverageRelativeError", "The average relative error of estimated values."));
     
    4350                      select values[i, ESTIMATION_INDEX];
    4451      AverageRelativeErrorParameter.ActualValue = new PercentValue(Calculate(original, estimated));
     52    }
     53
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new SimpleMeanAbsolutePercentageErrorEvaluator(this, cloner);
    4556    }
    4657
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageOfRangeErrorEvaluator.cs

    r4068 r5275  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3536    }
    3637
     38    [StorableConstructor]
     39    protected SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(bool deserializing) : base(deserializing) { }
     40    protected SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(SimpleMeanAbsolutePercentageOfRangeErrorEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
    3743    public SimpleMeanAbsolutePercentageOfRangeErrorEvaluator() {
    3844      Parameters.Add(new LookupParameter<PercentValue>("AveragePercentageOfRangeError", "The average relative (percentage of range) error of estimated values."));
     
    4551                      select values[i, ESTIMATION_INDEX];
    4652      AveragePercentageOfRangeErrorParameter.ActualValue = new PercentValue(Calculate(original, estimated));
     53    }
     54
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(this, cloner);
    4757    }
    4858
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleNMSEEvaluator.cs

    r4068 r5275  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3436    }
    3537
     38    [StorableConstructor]
     39    protected SimpleNMSEEvaluator(bool deserializing) : base(deserializing) { }
     40    protected SimpleNMSEEvaluator(SimpleNMSEEvaluator original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new SimpleNMSEEvaluator(this, cloner);
     45    }
    3646    public SimpleNMSEEvaluator() {
    3747      Parameters.Add(new LookupParameter<DoubleValue>("NormalizedMeanSquaredError", "The normalized mean squared error (divided by variance) of estimated values."));
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleRSquaredEvaluator.cs

    r4068 r5275  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2830
    2931namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    3234      get { return (ILookupParameter<DoubleValue>)Parameters["RSquared"]; }
    3335    }
    34 
     36    [StorableConstructor]
     37    protected SimpleRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     38    protected SimpleRSquaredEvaluator(SimpleRSquaredEvaluator original, Cloner cloner)
     39      : base(original, cloner) {
     40    }
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new SimpleRSquaredEvaluator(this, cloner);
     43    }
    3544    public SimpleRSquaredEvaluator() {
    3645      Parameters.Add(new LookupParameter<DoubleValue>("RSquared", "The squared Pearson's Product Moment Correlation (R²) of estimated values and original values."));
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleVarianceAccountedForEvaluator.cs

    r4068 r5275  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Parameters;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Evaluators {
     
    4041    }
    4142
     43    [StorableConstructor]
     44    protected SimpleVarianceAccountedForEvaluator(bool deserializing) : base(deserializing) { }
     45    protected SimpleVarianceAccountedForEvaluator(SimpleVarianceAccountedForEvaluator original, Cloner cloner)
     46      : base(original, cloner) {
     47    }
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new SimpleVarianceAccountedForEvaluator(this, cloner);
     50    }
    4251    public SimpleVarianceAccountedForEvaluator() {
    4352      Parameters.Add(new LookupParameter<DoubleValue>("VarianceAccountedFor", "The variance of the original values accounted for by the estimated values (VAF(y,y') = 1 - var(y-y') / var(y) )."));
Note: See TracChangeset for help on using the changeset viewer.