Changeset 14330 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators
- Timestamp:
- 10/13/16 19:47:41 (8 years ago)
- Location:
- branches/symbreg-factors-2650
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650
- Property svn:mergeinfo changed
/trunk/sources merged: 14282,14284-14300,14307,14314-14316,14319,14322
- Property svn:mergeinfo changed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 14289-14290,14292-14295
- Property svn:mergeinfo changed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ClassificationPerformanceMeasuresCalculator.cs
r14185 r14330 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 : IDeepCloneable { 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 = null) { 36 positiveClassName = original.positiveClassName; 37 positiveClassValue = original.positiveClassValue; 38 truePositiveCount = original.truePositiveCount; 39 falsePositiveCount = original.falsePositiveCount; 40 trueNegativeCount = original.trueNegativeCount; 41 falseNegativeCount = original.falseNegativeCount; 42 errorState = original.errorState; 34 43 } 35 44 … … 138 147 errorState = ErrorState; 139 148 } 149 150 // IDeepCloneable interface members 151 public object Clone() { 152 return new ClassificationPerformanceMeasuresCalculator(this); 153 } 154 155 public IDeepCloneable Clone(Cloner cloner) { 156 var clone = cloner.GetClone(this); 157 if (clone == null) { 158 clone = new ClassificationPerformanceMeasuresCalculator(this); 159 cloner.RegisterClonedObject(this, clone); 160 } 161 return clone; 162 } 140 163 } 141 164 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineAccuracyCalculator.cs
r14185 r14330 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlineAccuracyCalculator : IOnlineCalculator {27 public class OnlineAccuracyCalculator : IOnlineCalculator, IDeepCloneable { 28 28 29 29 private int correctlyClassified; … … 37 37 public OnlineAccuracyCalculator() { 38 38 Reset(); 39 } 40 41 // private constructor used internally by the Clone() method 42 protected OnlineAccuracyCalculator(OnlineAccuracyCalculator other, Cloner cloner = null) { 43 correctlyClassified = other.correctlyClassified; 44 n = other.n; 45 errorState = other.errorState; 39 46 } 40 47 … … 90 97 } 91 98 } 99 100 // IDeepCloneable interface members 101 public object Clone() { 102 return new OnlineAccuracyCalculator(this); 103 } 104 105 public IDeepCloneable Clone(Cloner cloner) { 106 var clone = cloner.GetClone(this); 107 if (clone == null) { 108 clone = new OnlineAccuracyCalculator(this); 109 cloner.RegisterClonedObject(this, clone); 110 } 111 return clone; 112 } 92 113 } 93 114 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineBoundedMeanSquaredErrorCalculator.cs
r14185 r14330 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 : IOnlineCalculator, IDeepCloneable { 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 = null) { 48 LowerBound = original.LowerBound; 49 UpperBound = original.UpperBound; 50 n = original.n; 51 errorSum = original.errorSum; 52 errorState = original.ErrorState; 44 53 } 45 54 … … 96 105 } 97 106 } 107 108 // IDeepCloneable interface members 109 public object Clone() { 110 return new OnlineBoundedMeanSquaredErrorCalculator(this); 111 } 112 113 public IDeepCloneable Clone(Cloner cloner) { 114 var clone = cloner.GetClone(this); 115 if (clone == null) { 116 clone = new OnlineBoundedMeanSquaredErrorCalculator(this); 117 cloner.RegisterClonedObject(this, clone); 118 } 119 return clone; 120 } 98 121 } 99 122 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalculator.cs
r14185 r14330 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 : IOnlineCalculator, IDeepCloneable { 27 28 28 29 private double xMean, yMean, Cn; … … 36 37 public OnlineCovarianceCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineCovarianceCalculator(OnlineCovarianceCalculator other, Cloner cloner = null) { 42 Cn = other.Cn; 43 xMean = other.xMean; 44 yMean = other.yMean; 45 n = other.n; 46 errorState = other.errorState; 38 47 } 39 48 … … 94 103 } 95 104 } 105 106 // IDeepCloneable interface members 107 public object Clone() { 108 return new OnlineCovarianceCalculator(this); 109 } 110 111 public IDeepCloneable Clone(Cloner cloner) { 112 var clone = cloner.GetClone(this); 113 if (clone == null) { 114 clone = new OnlineCovarianceCalculator(this); 115 cloner.RegisterClonedObject(this, clone); 116 } 117 return clone; 118 } 96 119 } 97 120 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineDirectionalSymmetryCalculator.cs
r14185 r14330 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis { 28 public class OnlineDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator {28 public class OnlineDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator, IDeepCloneable { 29 29 private int n; 30 30 private int nCorrect; … … 39 39 public OnlineDirectionalSymmetryCalculator() { 40 40 Reset(); 41 } 42 43 protected OnlineDirectionalSymmetryCalculator(OnlineDirectionalSymmetryCalculator other, Cloner cloner = null) { 44 n = other.n; 45 nCorrect = other.nCorrect; 46 errorState = other.errorState; 41 47 } 42 48 … … 94 100 return dsCalculator.DirectionalSymmetry; 95 101 } 96 102 97 103 public static double Calculate(IEnumerable<double> startValues, IEnumerable<IEnumerable<double>> actualContinuations, IEnumerable<IEnumerable<double>> predictedContinuations, out OnlineCalculatorError errorState) { 98 104 IEnumerator<double> startValueEnumerator = startValues.GetEnumerator(); … … 116 122 } 117 123 } 124 125 // IDeepCloneable interface members 126 public object Clone() { 127 return new OnlineDirectionalSymmetryCalculator(this); 128 } 129 130 public IDeepCloneable Clone(Cloner cloner) { 131 var clone = cloner.GetClone(this); 132 if (clone == null) { 133 clone = new OnlineDirectionalSymmetryCalculator(this); 134 cloner.RegisterClonedObject(this, clone); 135 } 136 return clone; 137 } 118 138 } 119 139 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs
r14185 r14330 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlineLinearScalingParameterCalculator {27 public class OnlineLinearScalingParameterCalculator : IDeepCloneable { 28 28 29 29 /// <summary> … … 65 65 Reset(); 66 66 } 67 68 protected OnlineLinearScalingParameterCalculator(OnlineLinearScalingParameterCalculator other, Cloner cloner) { 69 targetMeanCalculator = (OnlineMeanAndVarianceCalculator)other.targetMeanCalculator.Clone(cloner); 70 originalMeanAndVarianceCalculator = (OnlineMeanAndVarianceCalculator)other.originalMeanAndVarianceCalculator.Clone(cloner); 71 originalTargetCovarianceCalculator = (OnlineCovarianceCalculator)other.originalTargetCovarianceCalculator.Clone(cloner); 72 // do not reset the calculators here 73 } 74 67 75 68 76 public void Reset() { … … 117 125 } 118 126 } 127 128 // IDeepCloneable interface members 129 public object Clone() { 130 var cloner = new Cloner(); 131 return new OnlineLinearScalingParameterCalculator(this, cloner); 132 } 133 134 public IDeepCloneable Clone(Cloner cloner) { 135 var clone = cloner.GetClone(this); 136 if (clone == null) { 137 clone = new OnlineLinearScalingParameterCalculator(this, cloner); 138 cloner.RegisterClonedObject(this, clone); 139 } 140 return clone; 141 } 119 142 } 120 143 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs
r14185 r14330 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 : IOnlineCalculator, IDeepCloneable { 27 28 28 29 private double mae; … … 36 37 public OnlineMaxAbsoluteErrorCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineMaxAbsoluteErrorCalculator(OnlineMaxAbsoluteErrorCalculator other, Cloner cloner = null) { 42 mae = other.mae; 43 n = other.n; 44 errorState = other.errorState; 38 45 } 39 46 … … 88 95 } 89 96 } 97 98 // IDeepCloneable interface members 99 public object Clone() { 100 return new OnlineMaxAbsoluteErrorCalculator(this); 101 } 102 103 public IDeepCloneable Clone(Cloner cloner) { 104 var clone = cloner.GetClone(this); 105 if (clone == null) { 106 clone = new OnlineMaxAbsoluteErrorCalculator(this); 107 cloner.RegisterClonedObject(this, clone); 108 } 109 return clone; 110 } 90 111 } 91 112 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsoluteErrorCalculator.cs
r14185 r14330 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 : IOnlineCalculator, IDeepCloneable { 27 28 28 29 private double sae; … … 36 37 public OnlineMeanAbsoluteErrorCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineMeanAbsoluteErrorCalculator(OnlineMeanAbsoluteErrorCalculator other, Cloner cloner = null) { 42 sae = other.sae; 43 n = other.n; 44 errorState = other.errorState; 38 45 } 39 46 … … 87 94 } 88 95 } 96 97 // IDeepCloneable interface members 98 public object Clone() { 99 return new OnlineMeanAbsoluteErrorCalculator(this); 100 } 101 102 public IDeepCloneable Clone(Cloner cloner) { 103 var clone = cloner.GetClone(this); 104 if (clone == null) { 105 clone = new OnlineMeanAbsoluteErrorCalculator(this); 106 cloner.RegisterClonedObject(this, clone); 107 } 108 return clone; 109 } 89 110 } 90 111 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs
r14185 r14330 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlineMeanAbsolutePercentageErrorCalculator : IOnlineCalculator {27 public class OnlineMeanAbsolutePercentageErrorCalculator : IOnlineCalculator, IDeepCloneable { 28 28 29 29 private double sre; … … 37 37 public OnlineMeanAbsolutePercentageErrorCalculator() { 38 38 Reset(); 39 } 40 41 protected OnlineMeanAbsolutePercentageErrorCalculator(OnlineMeanAbsolutePercentageErrorCalculator other, Cloner cloner = null) { 42 sre = other.sre; 43 n = other.n; 44 errorState = other.errorState; 39 45 } 40 46 … … 89 95 } 90 96 } 97 98 // IDeepCloneable interface members 99 public object Clone() { 100 return new OnlineMeanAbsolutePercentageErrorCalculator(this); 101 } 102 103 public IDeepCloneable Clone(Cloner cloner) { 104 var clone = cloner.GetClone(this); 105 if (clone == null) { 106 clone = new OnlineMeanAbsolutePercentageErrorCalculator(this); 107 cloner.RegisterClonedObject(this, clone); 108 } 109 return clone; 110 } 91 111 } 92 112 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs
r14185 r14330 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 : IDeepCloneable { 26 27 27 28 private double m_oldM, m_newM, m_oldS, m_newS; … … 66 67 } 67 68 69 protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator other, Cloner cloner = null) { 70 m_oldS = other.m_oldS; 71 m_oldM = other.m_oldM; 72 m_newS = other.m_newS; 73 m_newM = other.m_newM; 74 n = other.n; 75 errorState = other.errorState; 76 varianceErrorState = other.varianceErrorState; 77 } 78 68 79 public void Reset() { 69 80 n = 0; … … 75 86 if (double.IsNaN(x) || double.IsInfinity(x) || x > 1E13 || x < -1E13 || (errorState & OnlineCalculatorError.InvalidValueAdded) > 0) { 76 87 errorState = errorState | OnlineCalculatorError.InvalidValueAdded; 77 varianceErrorState = errorState | OnlineCalculatorError.InvalidValueAdded;88 varianceErrorState = varianceErrorState | OnlineCalculatorError.InvalidValueAdded; 78 89 } else { 79 90 n++; … … 106 117 varianceErrorState = meanAndVarianceCalculator.VarianceErrorState; 107 118 } 119 120 // IDeepCloneable members 121 public object Clone() { 122 return new OnlineMeanAndVarianceCalculator(this); 123 } 124 125 public IDeepCloneable Clone(Cloner cloner) { 126 var clone = cloner.GetClone(this); 127 if (clone == null) { 128 clone = new OnlineMeanAndVarianceCalculator(this); 129 cloner.RegisterClonedObject(this, clone); 130 } 131 return clone; 132 } 108 133 } 109 134 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanErrorCalculator.cs
r14185 r14330 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 : IOnlineCalculator, IDeepCloneable { 27 28 28 29 private readonly OnlineMeanAndVarianceCalculator meanAndVarianceCalculator; … … 34 35 meanAndVarianceCalculator = new OnlineMeanAndVarianceCalculator(); 35 36 Reset(); 37 } 38 39 protected OnlineMeanErrorCalculator(OnlineMeanErrorCalculator other, Cloner cloner) { 40 meanAndVarianceCalculator = (OnlineMeanAndVarianceCalculator)other.meanAndVarianceCalculator.Clone(cloner); 36 41 } 37 42 … … 74 79 } 75 80 } 81 82 // IDeepCloneable members 83 public object Clone() { 84 var cloner = new Cloner(); 85 return new OnlineMeanErrorCalculator(this, cloner); 86 } 87 88 public IDeepCloneable Clone(Cloner cloner) { 89 var clone = cloner.GetClone(this); 90 if (clone == null) { 91 clone = new OnlineMeanErrorCalculator(this, cloner); 92 cloner.RegisterClonedObject(this, clone); 93 } 94 return clone; 95 } 76 96 } 77 97 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs
r14185 r14330 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 : IOnlineCalculator, IDeepCloneable { 27 28 28 29 private double sse; … … 36 37 public OnlineMeanSquaredErrorCalculator() { 37 38 Reset(); 39 } 40 41 protected OnlineMeanSquaredErrorCalculator(OnlineMeanSquaredErrorCalculator other, Cloner cloner = null) { 42 sse = other.sse; 43 n = other.n; 44 errorState = other.errorState; 38 45 } 39 46 … … 87 94 } 88 95 } 96 97 // IDeepCloneable members 98 public object Clone() { 99 return new OnlineMeanSquaredErrorCalculator(this); 100 } 101 102 public IDeepCloneable Clone(Cloner cloner) { 103 var clone = cloner.GetClone(this); 104 if (clone == null) { 105 clone = new OnlineMeanSquaredErrorCalculator(this); 106 cloner.RegisterClonedObject(this, clone); 107 } 108 return clone; 109 } 89 110 } 90 111 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs
r14226 r14330 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 : IOnlineCalculator, IDeepCloneable { 27 28 private OnlineMeanAndVarianceCalculator meanSquaredErrorCalculator; 28 29 private OnlineMeanAndVarianceCalculator originalVarianceCalculator; … … 40 41 originalVarianceCalculator = new OnlineMeanAndVarianceCalculator(); 41 42 Reset(); 43 } 44 45 protected OnlineNormalizedMeanSquaredErrorCalculator(OnlineNormalizedMeanSquaredErrorCalculator other, Cloner cloner) { 46 meanSquaredErrorCalculator = (OnlineMeanAndVarianceCalculator)other.meanSquaredErrorCalculator.Clone(cloner); 47 originalVarianceCalculator = (OnlineMeanAndVarianceCalculator)other.originalVarianceCalculator.Clone(cloner); 42 48 } 43 49 … … 92 98 } 93 99 } 100 101 // IDeepCloneable members 102 public object Clone() { 103 var cloner = new Cloner(); 104 return new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner); 105 } 106 107 public IDeepCloneable Clone(Cloner cloner) { 108 var clone = cloner.GetClone(this); 109 if (clone == null) { 110 clone = new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner); 111 cloner.RegisterClonedObject(this, clone); 112 } 113 return clone; 114 } 94 115 } 95 116 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRCalculator.cs
r14185 r14330 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 public class OnlinePearsonsRCalculator : IOnlineCalculator {27 public class OnlinePearsonsRCalculator : IOnlineCalculator, IDeepCloneable { 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 other, Cloner cloner) { 50 covCalculator = (OnlineCovarianceCalculator)other.covCalculator.Clone(cloner); 51 sxCalculator = (OnlineMeanAndVarianceCalculator)other.sxCalculator.Clone(cloner); 52 syCalculator = (OnlineMeanAndVarianceCalculator)other.syCalculator.Clone(cloner); 53 } 48 54 49 55 #region IOnlineCalculator Members … … 91 97 } 92 98 } 99 100 // IDeepCloneable members 101 public object Clone() { 102 var cloner = new Cloner(); 103 return new OnlinePearsonsRCalculator(this, cloner); 104 } 105 106 public IDeepCloneable Clone(Cloner cloner) { 107 var clone = cloner.GetClone(this); 108 if (clone == null) { 109 clone = new OnlinePearsonsRCalculator(this, cloner); 110 cloner.RegisterClonedObject(this, clone); 111 } 112 return clone; 113 } 93 114 } 94 115 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs
r14185 r14330 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 27 [Obsolete("Use OnlinePearsonsRCalculator directly")] 28 public class OnlinePearsonsRSquaredCalculator : IOnlineCalculator {28 public class OnlinePearsonsRSquaredCalculator : IOnlineCalculator, IDeepCloneable { 29 29 private readonly OnlinePearsonsRCalculator rCalculator = new OnlinePearsonsRCalculator(); 30 30 … … 37 37 38 38 public OnlinePearsonsRSquaredCalculator() { } 39 40 protected OnlinePearsonsRSquaredCalculator(OnlinePearsonsRSquaredCalculator other, Cloner cloner) { 41 this.rCalculator = (OnlinePearsonsRCalculator)other.rCalculator.Clone(cloner); 42 } 39 43 40 44 #region IOnlineCalculator Members … … 59 63 return r * r; 60 64 } 65 66 // IDeepCloneable members 67 public object Clone() { 68 var cloner = new Cloner(); 69 return new OnlinePearsonsRSquaredCalculator(this, cloner); 70 } 71 72 public IDeepCloneable Clone(Cloner cloner) { 73 var clone = cloner.GetClone(this); 74 if (clone == null) { 75 clone = new OnlinePearsonsRSquaredCalculator(this, cloner); 76 cloner.RegisterClonedObject(this, clone); 77 } 78 return clone; 79 } 61 80 } 62 81 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineTheilsUStatisticCalculator.cs
r14185 r14330 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 public class OnlineTheilsUStatisticCalculator : IOnlineTimeSeriesCalculator, IDeepCloneable { 27 28 private OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator; 28 29 private OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator; … … 43 44 unbiasedEstimatorMeanCalculator = new OnlineMeanAndVarianceCalculator(); 44 45 Reset(); 46 } 47 48 protected OnlineTheilsUStatisticCalculator(OnlineTheilsUStatisticCalculator other, Cloner cloner) { 49 squaredErrorMeanCalculator = (OnlineMeanAndVarianceCalculator)other.squaredErrorMeanCalculator.Clone(cloner); 50 unbiasedEstimatorMeanCalculator = (OnlineMeanAndVarianceCalculator)other.unbiasedEstimatorMeanCalculator.Clone(cloner); 45 51 } 46 52 … … 125 131 } 126 132 } 133 134 // IDeepCloneable members 135 public object Clone() { 136 var cloner = new Cloner(); 137 return new OnlineTheilsUStatisticCalculator(this, cloner); 138 } 139 140 public IDeepCloneable Clone(Cloner cloner) { 141 var clone = cloner.GetClone(this); 142 if (clone == null) { 143 clone = new OnlineTheilsUStatisticCalculator(this, cloner); 144 cloner.RegisterClonedObject(this, clone); 145 } 146 return clone; 147 } 127 148 } 128 149 } -
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedDirectionalSymmetryCalculator.cs
r14185 r14330 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis { 28 public class OnlineWeightedDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator {28 public class OnlineWeightedDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator, IDeepCloneable { 29 29 private int n; 30 30 private double correctSum; … … 40 40 public OnlineWeightedDirectionalSymmetryCalculator() { 41 41 Reset(); 42 } 43 44 protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator other, Cloner cloner = null) { 45 n = other.n; 46 correctSum = other.correctSum; 47 incorrectSum = other.incorrectSum; 48 errorState = other.errorState; 42 49 } 43 50 … … 118 125 } 119 126 } 127 128 // IDeepCloneable members 129 public object Clone() { 130 return new OnlineWeightedDirectionalSymmetryCalculator(this); 131 } 132 133 public IDeepCloneable Clone(Cloner cloner) { 134 var clone = cloner.GetClone(this); 135 if (clone == null) { 136 clone = new OnlineWeightedDirectionalSymmetryCalculator(this); 137 cloner.RegisterClonedObject(this, clone); 138 } 139 return clone; 140 } 120 141 } 121 142 }
Note: See TracChangeset
for help on using the changeset viewer.