- Timestamp:
- 01/11/11 15:03:46 (14 years ago)
- 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 25 25 public class OnlineCovarianceEvaluator : IOnlineEvaluator { 26 26 27 private double xMean, yMean, Cn;27 private double originalMean, estimatedMean, Cn; 28 28 private int n; 29 29 public double Covariance { … … 47 47 n = 0; 48 48 Cn = 0.0; 49 xMean = 0.0;50 yMean = 0.0;49 originalMean = 0.0; 50 estimatedMean = 0.0; 51 51 } 52 52 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)) { 56 56 throw new ArgumentException("Covariance is not defined for series containing NaN or infinity elements"); 57 57 } else { 58 58 n++; 59 59 // 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; 64 63 65 64 // online calculation of covariance 66 Cn = Cn + delta Y * (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)) 67 66 } 68 67 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleEvaluator.cs
r4068 r5275 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Operators; 25 26 using HeuristicLab.Parameters; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 27 29 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 32 34 public ILookupParameter<DoubleMatrix> ValuesParameter { 33 35 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) { 34 41 } 35 42 public SimpleEvaluator() -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMSEEvaluator.cs
r4341 r5275 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 29 31 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 34 36 } 35 37 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 } 36 46 public SimpleMSEEvaluator() { 37 47 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 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 29 31 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 33 35 } 34 36 37 [StorableConstructor] 38 protected SimpleMeanAbsolutePercentageErrorEvaluator(bool deserializing) : base(deserializing) { } 39 protected SimpleMeanAbsolutePercentageErrorEvaluator(SimpleMeanAbsolutePercentageErrorEvaluator original, Cloner cloner) 40 : base(original, cloner) { 41 } 35 42 public SimpleMeanAbsolutePercentageErrorEvaluator() { 36 43 Parameters.Add(new LookupParameter<PercentValue>("AverageRelativeError", "The average relative error of estimated values.")); … … 43 50 select values[i, ESTIMATION_INDEX]; 44 51 AverageRelativeErrorParameter.ActualValue = new PercentValue(Calculate(original, estimated)); 52 } 53 54 public override IDeepCloneable Clone(Cloner cloner) { 55 return new SimpleMeanAbsolutePercentageErrorEvaluator(this, cloner); 45 56 } 46 57 -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleMeanAbsolutePercentageOfRangeErrorEvaluator.cs
r4068 r5275 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 30 31 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 35 36 } 36 37 38 [StorableConstructor] 39 protected SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(bool deserializing) : base(deserializing) { } 40 protected SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(SimpleMeanAbsolutePercentageOfRangeErrorEvaluator original, Cloner cloner) 41 : base(original, cloner) { 42 } 37 43 public SimpleMeanAbsolutePercentageOfRangeErrorEvaluator() { 38 44 Parameters.Add(new LookupParameter<PercentValue>("AveragePercentageOfRangeError", "The average relative (percentage of range) error of estimated values.")); … … 45 51 select values[i, ESTIMATION_INDEX]; 46 52 AveragePercentageOfRangeErrorParameter.ActualValue = new PercentValue(Calculate(original, estimated)); 53 } 54 55 public override IDeepCloneable Clone(Cloner cloner) { 56 return new SimpleMeanAbsolutePercentageOfRangeErrorEvaluator(this, cloner); 47 57 } 48 58 -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Evaluators/SimpleNMSEEvaluator.cs
r4068 r5275 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 29 31 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 34 36 } 35 37 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 } 36 46 public SimpleNMSEEvaluator() { 37 47 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 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 29 31 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 32 34 get { return (ILookupParameter<DoubleValue>)Parameters["RSquared"]; } 33 35 } 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 } 35 44 public SimpleRSquaredEvaluator() { 36 45 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 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 30 31 namespace HeuristicLab.Problems.DataAnalysis.Evaluators { … … 40 41 } 41 42 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 } 42 51 public SimpleVarianceAccountedForEvaluator() { 43 52 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.