Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators
- Timestamp:
- 06/28/18 11:13:37 (7 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/AutoCorrelationCalculator.cs
r12817 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ClassificationPerformanceMeasuresCalculator.cs
r13102 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using HeuristicLab.Common; 25 using HeuristicLab.Problems.DataAnalysis.OnlineCalculators;26 25 27 26 namespace HeuristicLab.Problems.DataAnalysis { 28 public class ClassificationPerformanceMeasuresCalculator {27 public class ClassificationPerformanceMeasuresCalculator : DeepCloneable { 29 28 30 29 public ClassificationPerformanceMeasuresCalculator(string positiveClassName, double positiveClassValue) { … … 32 31 this.positiveClassValue = positiveClassValue; 33 32 Reset(); 33 } 34 35 protected ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator original, Cloner cloner) 36 : base(original, cloner) { 37 positiveClassName = original.positiveClassName; 38 positiveClassValue = original.positiveClassValue; 39 truePositiveCount = original.truePositiveCount; 40 falsePositiveCount = original.falsePositiveCount; 41 trueNegativeCount = original.trueNegativeCount; 42 falseNegativeCount = original.falseNegativeCount; 43 errorState = original.errorState; 44 } 45 public override IDeepCloneable Clone(Cloner cloner) { 46 return new ClassificationPerformanceMeasuresCalculator(this, cloner); 34 47 } 35 48 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ConfusionMatrixCalculator.cs
r13103 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 public class ConfusionMatrixCalculator { 28 28 public static double[,] Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, out OnlineCalculatorError errorState) { 29 if (!originalValues.Any() || !estimatedValues.Any()) { 30 errorState = OnlineCalculatorError.InsufficientElementsAdded; 31 return null; 32 } 29 33 30 34 Dictionary<double, int> classValueIndexMapping = new Dictionary<double, int>(); -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/DependencyCalculator/HoeffdingsDependenceCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 41 41 if (errorState != OnlineCalculatorError.None) return double.NaN; 42 42 return d; 43 } 44 45 public double Calculate(IEnumerable<Tuple<double, double>> values, out OnlineCalculatorError errorState) { 46 return HoeffD(values.Select(v => v.Item1), values.Select(v => v.Item2), out errorState); 43 47 } 44 48 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/DependencyCalculator/PearsonsRDependenceCalculator.cs
r12492 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 35 35 return OnlinePearsonsRCalculator.Calculate(originalValues, estimatedValues, out errorState); 36 36 } 37 38 public double Calculate(IEnumerable<Tuple<double, double>> values, out OnlineCalculatorError errorState) { 39 var calculator = new OnlinePearsonsRCalculator(); 40 foreach (var tuple in values) { 41 calculator.Add(tuple.Item1, tuple.Item2); 42 if (calculator.ErrorState != OnlineCalculatorError.None) break; 43 } 44 errorState = calculator.ErrorState; 45 return calculator.R; 46 } 37 47 } 38 48 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/DependencyCalculator/PearsonsRSquaredDependenceCalculator.cs
r12641 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 … … 35 36 return r * r; 36 37 } 38 39 public double Calculate(IEnumerable<Tuple<double, double>> values, out OnlineCalculatorError errorState) { 40 var calculator = new OnlinePearsonsRCalculator(); 41 foreach (var tuple in values) { 42 calculator.Add(tuple.Item1, tuple.Item2); 43 if (calculator.ErrorState != OnlineCalculatorError.None) break; 44 } 45 errorState = calculator.ErrorState; 46 var r = calculator.R; 47 return r * r; 48 } 37 49 } 38 50 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/DependencyCalculator/SpearmansRankCorrelationCoefficientCalculator.cs
r12817 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 33 34 34 35 public double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, out OnlineCalculatorError errorState) { 35 return SpearmansRankCorrelationCoefficientCalculator.CalculateSpearmansRank(originalValues, estimatedValues, out errorState); 36 return CalculateSpearmansRank(originalValues, estimatedValues, out errorState); 37 } 38 public double Calculate(IEnumerable<Tuple<double, double>> values, out OnlineCalculatorError errorState) { 39 return CalculateSpearmansRank(values.Select(v => v.Item1), values.Select(v => v.Item2), out errorState); 36 40 } 37 41 … … 50 54 return rs; 51 55 } 56 57 52 58 } 53 59 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/FOneScoreCalculator.cs
r13103 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 36 36 return double.NaN; 37 37 } 38 //only one class has been present => F1 score cannot be calculated 39 if (confusionMatrix.GetLength(0) != 2 || confusionMatrix.GetLength(1) != 2) { 40 return double.NaN; 41 } 42 38 43 return CalculateFOne(confusionMatrix); 39 44 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/MatthewsCorrelationCoefficientCalculator.cs
r13100 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/NormalizedGiniCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineAccuracyCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlineAccuracyCalculator : IOnlineCalculator {27 public class OnlineAccuracyCalculator : DeepCloneable, IOnlineCalculator { 28 28 29 29 private int correctlyClassified; … … 38 38 Reset(); 39 39 } 40 41 protected OnlineAccuracyCalculator(OnlineAccuracyCalculator original, Cloner cloner) 42 : base(original, cloner) { 43 correctlyClassified = original.correctlyClassified; 44 n = original.n; 45 errorState = original.errorState; 46 } 47 48 public override IDeepCloneable Clone(Cloner cloner) { 49 return new OnlineAccuracyCalculator(this, cloner); 50 } 51 40 52 41 53 #region IOnlineCalculator Members … … 90 102 } 91 103 } 104 92 105 } 93 106 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineBoundedMeanSquaredErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineBoundedMeanSquaredErrorCalculator : IOnlineCalculator {27 public class OnlineBoundedMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator { 27 28 28 29 private double errorSum; … … 38 39 39 40 40 public OnlineBoundedMeanSquaredErrorCalculator(double lowerBound, double upper bound) {41 public OnlineBoundedMeanSquaredErrorCalculator(double lowerBound, double upperBound) { 41 42 LowerBound = lowerBound; 42 UpperBound = upper bound;43 UpperBound = upperBound; 43 44 Reset(); 45 } 46 47 protected OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator original, Cloner cloner) 48 : base(original, cloner) { 49 LowerBound = original.LowerBound; 50 UpperBound = original.UpperBound; 51 n = original.n; 52 errorSum = original.errorSum; 53 errorState = original.ErrorState; 54 } 55 public override IDeepCloneable Clone(Cloner cloner) { 56 return new OnlineBoundedMeanSquaredErrorCalculator(this, cloner); 44 57 } 45 58 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineCovarianceCalculator : IOnlineCalculator {27 public class OnlineCovarianceCalculator : DeepCloneable, IOnlineCalculator { 27 28 28 29 private double xMean, yMean, Cn; … … 36 37 public OnlineCovarianceCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineCovarianceCalculator(OnlineCovarianceCalculator original, Cloner cloner) 42 : base(original, cloner) { 43 Cn = original.Cn; 44 xMean = original.xMean; 45 yMean = original.yMean; 46 n = original.n; 47 errorState = original.errorState; 48 } 49 50 public override IDeepCloneable Clone(Cloner cloner) { 51 return new OnlineCovarianceCalculator(this, cloner); 38 52 } 39 53 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineDirectionalSymmetryCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis { 28 public class OnlineDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator {28 public class OnlineDirectionalSymmetryCalculator : DeepCloneable, IOnlineTimeSeriesCalculator { 29 29 private int n; 30 30 private int nCorrect; … … 39 39 public OnlineDirectionalSymmetryCalculator() { 40 40 Reset(); 41 } 42 43 protected OnlineDirectionalSymmetryCalculator(OnlineDirectionalSymmetryCalculator original, Cloner cloner = null) 44 : base(original, cloner) { 45 n = original.n; 46 nCorrect = original.nCorrect; 47 errorState = original.errorState; 48 } 49 50 public override IDeepCloneable Clone(Cloner cloner) { 51 return new OnlineDirectionalSymmetryCalculator(this, cloner); 41 52 } 42 53 … … 94 105 return dsCalculator.DirectionalSymmetry; 95 106 } 96 107 97 108 public static double Calculate(IEnumerable<double> startValues, IEnumerable<IEnumerable<double>> actualContinuations, IEnumerable<IEnumerable<double>> predictedContinuations, out OnlineCalculatorError errorState) { 98 109 IEnumerator<double> startValueEnumerator = startValues.GetEnumerator(); -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlineLinearScalingParameterCalculator {27 public class OnlineLinearScalingParameterCalculator : DeepCloneable { 28 28 29 29 /// <summary> … … 55 55 } 56 56 57 private OnlineMeanAndVarianceCalculator targetMeanCalculator;58 private OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator;59 private OnlineCovarianceCalculator originalTargetCovarianceCalculator;57 private readonly OnlineMeanAndVarianceCalculator targetMeanCalculator; 58 private readonly OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator; 59 private readonly OnlineCovarianceCalculator originalTargetCovarianceCalculator; 60 60 61 61 public OnlineLinearScalingParameterCalculator() { … … 65 65 Reset(); 66 66 } 67 68 protected OnlineLinearScalingParameterCalculator(OnlineLinearScalingParameterCalculator original, Cloner cloner) 69 : base(original, cloner) { 70 targetMeanCalculator = cloner.Clone(original.targetMeanCalculator); 71 originalMeanAndVarianceCalculator = cloner.Clone(original.originalMeanAndVarianceCalculator); 72 originalTargetCovarianceCalculator = cloner.Clone(original.originalTargetCovarianceCalculator); 73 // do not reset the calculators here 74 } 75 public override IDeepCloneable Clone(Cloner cloner) { 76 return new OnlineLinearScalingParameterCalculator(this, cloner); 77 } 78 67 79 68 80 public void Reset() { -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineMaxAbsoluteErrorCalculator : IOnlineCalculator {27 public class OnlineMaxAbsoluteErrorCalculator : DeepCloneable, IOnlineCalculator { 27 28 28 29 private double mae; … … 36 37 public OnlineMaxAbsoluteErrorCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineMaxAbsoluteErrorCalculator(OnlineMaxAbsoluteErrorCalculator original, Cloner cloner = null) 42 : base(original, cloner) { 43 mae = original.mae; 44 n = original.n; 45 errorState = original.errorState; 46 } 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new OnlineMaxAbsoluteErrorCalculator(this, cloner); 38 49 } 39 50 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsoluteErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineMeanAbsoluteErrorCalculator : IOnlineCalculator {27 public class OnlineMeanAbsoluteErrorCalculator : DeepCloneable, IOnlineCalculator { 27 28 28 29 private double sae; … … 36 37 public OnlineMeanAbsoluteErrorCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineMeanAbsoluteErrorCalculator(OnlineMeanAbsoluteErrorCalculator original, Cloner cloner = null) 42 : base(original, cloner) { 43 sae = original.sae; 44 n = original.n; 45 errorState = original.errorState; 46 } 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new OnlineMeanAbsoluteErrorCalculator(this, cloner); 38 49 } 39 50 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlineMeanAbsolutePercentageErrorCalculator : IOnlineCalculator {27 public class OnlineMeanAbsolutePercentageErrorCalculator : DeepCloneable, IOnlineCalculator { 28 28 29 29 private double sre; … … 37 37 public OnlineMeanAbsolutePercentageErrorCalculator() { 38 38 Reset(); 39 } 40 41 protected OnlineMeanAbsolutePercentageErrorCalculator(OnlineMeanAbsolutePercentageErrorCalculator original, Cloner cloner = null) 42 : base(original, cloner) { 43 sre = original.sre; 44 n = original.n; 45 errorState = original.errorState; 46 } 47 48 public override IDeepCloneable Clone(Cloner cloner) { 49 return new OnlineMeanAbsolutePercentageErrorCalculator(this, cloner); 39 50 } 40 51 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 24 25 namespace HeuristicLab.Problems.DataAnalysis { 25 public class OnlineMeanAndVarianceCalculator {26 public class OnlineMeanAndVarianceCalculator : DeepCloneable { 26 27 27 28 private double m_oldM, m_newM, m_oldS, m_newS; … … 66 67 } 67 68 69 protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator original, Cloner cloner = null) 70 : base(original, cloner) { 71 m_oldS = original.m_oldS; 72 m_oldM = original.m_oldM; 73 m_newS = original.m_newS; 74 m_newM = original.m_newM; 75 n = original.n; 76 errorState = original.errorState; 77 varianceErrorState = original.varianceErrorState; 78 } 79 public override IDeepCloneable Clone(Cloner cloner) { 80 return new OnlineMeanAndVarianceCalculator(this, cloner); 81 } 82 68 83 public void Reset() { 69 84 n = 0; … … 75 90 if (double.IsNaN(x) || double.IsInfinity(x) || x > 1E13 || x < -1E13 || (errorState & OnlineCalculatorError.InvalidValueAdded) > 0) { 76 91 errorState = errorState | OnlineCalculatorError.InvalidValueAdded; 77 varianceErrorState = errorState | OnlineCalculatorError.InvalidValueAdded;92 varianceErrorState = varianceErrorState | OnlineCalculatorError.InvalidValueAdded; 78 93 } else { 79 94 n++; -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineMeanErrorCalculator : IOnlineCalculator {27 public class OnlineMeanErrorCalculator : DeepCloneable, IOnlineCalculator { 27 28 28 29 private readonly OnlineMeanAndVarianceCalculator meanAndVarianceCalculator; … … 34 35 meanAndVarianceCalculator = new OnlineMeanAndVarianceCalculator(); 35 36 Reset(); 37 } 38 39 protected OnlineMeanErrorCalculator(OnlineMeanErrorCalculator original, Cloner cloner) 40 : base(original, cloner) { 41 meanAndVarianceCalculator = cloner.Clone(original.meanAndVarianceCalculator); 42 } 43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new OnlineMeanErrorCalculator(this, cloner); 36 45 } 37 46 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineMeanSquaredErrorCalculator : IOnlineCalculator {27 public class OnlineMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator { 27 28 28 29 private double sse; … … 36 37 public OnlineMeanSquaredErrorCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineMeanSquaredErrorCalculator(OnlineMeanSquaredErrorCalculator original, Cloner cloner) 42 : base(original, cloner) { 43 sse = original.sse; 44 n = original.n; 45 errorState = original.errorState; 46 } 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new OnlineMeanSquaredErrorCalculator(this, cloner); 38 49 } 39 50 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineNormalizedMeanSquaredErrorCalculator : IOnlineCalculator {27 public class OnlineNormalizedMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator { 27 28 private OnlineMeanAndVarianceCalculator meanSquaredErrorCalculator; 28 29 private OnlineMeanAndVarianceCalculator originalVarianceCalculator; … … 30 31 public double NormalizedMeanSquaredError { 31 32 get { 32 double var = originalVarianceCalculator. Variance;33 double var = originalVarianceCalculator.PopulationVariance; 33 34 double m = meanSquaredErrorCalculator.Mean; 34 35 return var > 0 ? m / var : 0.0; … … 42 43 } 43 44 45 protected OnlineNormalizedMeanSquaredErrorCalculator(OnlineNormalizedMeanSquaredErrorCalculator original, Cloner cloner) 46 : base(original, cloner) { 47 meanSquaredErrorCalculator = cloner.Clone(original.meanSquaredErrorCalculator); 48 originalVarianceCalculator = cloner.Clone(original.originalVarianceCalculator); 49 } 50 public override IDeepCloneable Clone(Cloner cloner) { 51 return new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner); 52 } 53 44 54 #region IOnlineCalculator Members 45 55 public OnlineCalculatorError ErrorState { 46 get { return meanSquaredErrorCalculator.MeanErrorState | originalVarianceCalculator. VarianceErrorState; }56 get { return meanSquaredErrorCalculator.MeanErrorState | originalVarianceCalculator.PopulationVarianceErrorState; } 47 57 } 48 58 public double Value { … … 92 102 } 93 103 } 104 105 94 106 } 95 107 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRCalculator.cs
r13038 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlinePearsonsRCalculator : IOnlineCalculator {27 public class OnlinePearsonsRCalculator : DeepCloneable, IOnlineCalculator { 28 28 private OnlineCovarianceCalculator covCalculator = new OnlineCovarianceCalculator(); 29 29 private OnlineMeanAndVarianceCalculator sxCalculator = new OnlineMeanAndVarianceCalculator(); … … 46 46 47 47 public OnlinePearsonsRCalculator() { } 48 49 protected OnlinePearsonsRCalculator(OnlinePearsonsRCalculator original, Cloner cloner) 50 : base(original, cloner) { 51 covCalculator = cloner.Clone(original.covCalculator); 52 sxCalculator = cloner.Clone(original.sxCalculator); 53 syCalculator = cloner.Clone(original.syCalculator); 54 } 55 public override IDeepCloneable Clone(Cloner cloner) { 56 return new OnlinePearsonsRCalculator(this, cloner); 57 } 48 58 49 59 #region IOnlineCalculator Members -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs
r12492 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 27 [Obsolete("Use OnlinePearsonsRCalculator directly")] 28 public class OnlinePearsonsRSquaredCalculator : IOnlineCalculator {28 public class OnlinePearsonsRSquaredCalculator : DeepCloneable, IOnlineCalculator { 29 29 private readonly OnlinePearsonsRCalculator rCalculator = new OnlinePearsonsRCalculator(); 30 30 … … 37 37 38 38 public OnlinePearsonsRSquaredCalculator() { } 39 40 protected OnlinePearsonsRSquaredCalculator(OnlinePearsonsRSquaredCalculator original, Cloner cloner) 41 : base(original, cloner) { 42 rCalculator = cloner.Clone(original.rCalculator); 43 } 44 public override IDeepCloneable Clone(Cloner cloner) { 45 return new OnlinePearsonsRSquaredCalculator(this, cloner); 46 } 39 47 40 48 #region IOnlineCalculator Members … … 59 67 return r * r; 60 68 } 69 70 61 71 } 62 72 } -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineTheilsUStatisticCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineTheilsUStatisticCalculator : IOnlineTimeSeriesCalculator {27 private OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator;28 private OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator;27 public class OnlineTheilsUStatisticCalculator : DeepCloneable, IOnlineTimeSeriesCalculator { 28 private readonly OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator; 29 private readonly OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator; 29 30 30 31 public double TheilsUStatistic { … … 43 44 unbiasedEstimatorMeanCalculator = new OnlineMeanAndVarianceCalculator(); 44 45 Reset(); 46 } 47 48 protected OnlineTheilsUStatisticCalculator(OnlineTheilsUStatisticCalculator original, Cloner cloner) 49 : base(original, cloner) { 50 squaredErrorMeanCalculator = cloner.Clone(original.squaredErrorMeanCalculator); 51 unbiasedEstimatorMeanCalculator = cloner.Clone(original.unbiasedEstimatorMeanCalculator); 52 } 53 public override IDeepCloneable Clone(Cloner cloner) { 54 return new OnlineTheilsUStatisticCalculator(this, cloner); 45 55 } 46 56 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedDirectionalSymmetryCalculator.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis { 28 public class OnlineWeightedDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator {28 public class OnlineWeightedDirectionalSymmetryCalculator : DeepCloneable, IOnlineTimeSeriesCalculator { 29 29 private int n; 30 30 private double correctSum; … … 40 40 public OnlineWeightedDirectionalSymmetryCalculator() { 41 41 Reset(); 42 } 43 44 protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator original, Cloner cloner) 45 : base(original, cloner) { 46 n = original.n; 47 correctSum = original.correctSum; 48 incorrectSum = original.incorrectSum; 49 errorState = original.errorState; 50 } 51 52 public override IDeepCloneable Clone(Cloner cloner) { 53 return new OnlineWeightedDirectionalSymmetryCalculator(this, cloner); 42 54 } 43 55
Note: See TracChangeset
for help on using the changeset viewer.