Changeset 14293 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4
- Timestamp:
- 09/20/16 15:51:04 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ClassificationPerformanceMeasuresCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 36 private ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator other) { 37 // copy everything including the errorState 38 positiveClassName = other.positiveClassName; 39 positiveClassValue = other.positiveClassValue; 40 truePositiveCount = other.truePositiveCount; 41 falsePositiveCount = other.falsePositiveCount; 42 trueNegativeCount = other.trueNegativeCount; 43 falseNegativeCount = other.falseNegativeCount; 44 errorState = other.errorState; 34 45 } 35 46 … … 138 149 errorState = ErrorState; 139 150 } 151 152 // IDeepCloneable interface members 153 public object Clone() { 154 return new ClassificationPerformanceMeasuresCalculator(this); 155 } 156 157 public IDeepCloneable Clone(Cloner cloner) { 158 var clone = cloner.GetClone(this); 159 if (clone == null) { 160 clone = (IDeepCloneable)this.Clone(); 161 cloner.RegisterClonedObject(this, clone); 162 } 163 return clone; 164 } 140 165 } 141 166 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineAccuracyCalculator.cs
r14185 r14293 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 private OnlineAccuracyCalculator(OnlineAccuracyCalculator other) { 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 = (IDeepCloneable)this.Clone(); 109 cloner.RegisterClonedObject(this, clone); 110 } 111 return clone; 112 } 92 113 } 93 114 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineBoundedMeanSquaredErrorCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 48 private OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator other) { 49 LowerBound = other.LowerBound; 50 UpperBound = other.UpperBound; 51 n = other.n; 52 errorSum = other.errorSum; 53 errorState = other.ErrorState; 44 54 } 45 55 … … 96 106 } 97 107 } 108 109 // IDeepCloneable interface members 110 public object Clone() { 111 return new OnlineBoundedMeanSquaredErrorCalculator(this); 112 } 113 114 public IDeepCloneable Clone(Cloner cloner) { 115 var clone = cloner.GetClone(this); 116 if (clone == null) { 117 clone = (IDeepCloneable)this.Clone(); 118 cloner.RegisterClonedObject(this, clone); 119 } 120 return clone; 121 } 98 122 } 99 123 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 42 private OnlineCovarianceCalculator(OnlineCovarianceCalculator other) : this() { 43 Cn = other.Cn; 44 xMean = other.xMean; 45 yMean = other.yMean; 46 n = other.n; 47 errorState = other.errorState; 38 48 } 39 49 … … 94 104 } 95 105 } 106 107 // IDeepCloneable interface members 108 public object Clone() { 109 return new OnlineCovarianceCalculator(this); 110 } 111 112 public IDeepCloneable Clone(Cloner cloner) { 113 var clone = cloner.GetClone(this); 114 if (clone == null) { 115 clone = (IDeepCloneable)this.Clone(); 116 cloner.RegisterClonedObject(this, clone); 117 } 118 return clone; 119 } 96 120 } 97 121 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineDirectionalSymmetryCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 44 private OnlineDirectionalSymmetryCalculator(OnlineDirectionalSymmetryCalculator other) { 45 n = other.n; 46 nCorrect = other.nCorrect; 47 errorState = other.errorState; 41 48 } 42 49 … … 94 101 return dsCalculator.DirectionalSymmetry; 95 102 } 96 103 97 104 public static double Calculate(IEnumerable<double> startValues, IEnumerable<IEnumerable<double>> actualContinuations, IEnumerable<IEnumerable<double>> predictedContinuations, out OnlineCalculatorError errorState) { 98 105 IEnumerator<double> startValueEnumerator = startValues.GetEnumerator(); … … 116 123 } 117 124 } 125 126 // IDeepCloneable interface members 127 public object Clone() { 128 return new OnlineDirectionalSymmetryCalculator(this); 129 } 130 131 public IDeepCloneable Clone(Cloner cloner) { 132 var clone = cloner.GetClone(this); 133 if (clone == null) { 134 clone = (IDeepCloneable)this.Clone(); 135 cloner.RegisterClonedObject(this, clone); 136 } 137 return clone; 138 } 118 139 } 119 140 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 69 private OnlineLinearScalingParameterCalculator(OnlineMeanAndVarianceCalculator targetMeanCalculator, OnlineMeanAndVarianceCalculator originalMeanAndVarianceCalculator, OnlineCovarianceCalculator originalTargetCovarianceCalculator) { 70 this.targetMeanCalculator = targetMeanCalculator; 71 this.originalMeanAndVarianceCalculator = originalMeanAndVarianceCalculator; 72 this.originalTargetCovarianceCalculator = originalTargetCovarianceCalculator; 73 // do not reset the calculators here 74 } 75 67 76 68 77 public void Reset() { … … 117 126 } 118 127 } 128 129 // IDeepCloneable interface members 130 public object Clone() { 131 var targetMeanCalculatorClone = (OnlineMeanAndVarianceCalculator)targetMeanCalculator.Clone(); 132 var originalMeanAndVarianceCalculatorClone = (OnlineMeanAndVarianceCalculator)originalMeanAndVarianceCalculator.Clone(); 133 var originalTargetCovarianceCalculatorClone = (OnlineCovarianceCalculator)originalTargetCovarianceCalculator.Clone(); 134 return new OnlineLinearScalingParameterCalculator(targetMeanCalculatorClone, originalMeanAndVarianceCalculatorClone, originalTargetCovarianceCalculatorClone); 135 } 136 137 public IDeepCloneable Clone(Cloner cloner) { 138 var clone = cloner.GetClone(this); 139 if (clone == null) { 140 var targetMeanCalculatorClone = (OnlineMeanAndVarianceCalculator)targetMeanCalculator.Clone(cloner); 141 var originalMeanAndVarianceCalculatorClone = (OnlineMeanAndVarianceCalculator)originalMeanAndVarianceCalculator.Clone(cloner); 142 var originalTargetCovarianceCalculatorClone = (OnlineCovarianceCalculator)originalTargetCovarianceCalculator.Clone(cloner); 143 clone = new OnlineLinearScalingParameterCalculator(targetMeanCalculatorClone, originalMeanAndVarianceCalculatorClone, originalTargetCovarianceCalculatorClone); 144 cloner.RegisterClonedObject(this, clone); 145 } 146 return clone; 147 } 119 148 } 120 149 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 42 private OnlineMaxAbsoluteErrorCalculator(OnlineMaxAbsoluteErrorCalculator other) { 43 mae = other.mae; 44 n = other.n; 45 errorState = other.errorState; 38 46 } 39 47 … … 88 96 } 89 97 } 98 99 // IDeepCloneable interface members 100 public object Clone() { 101 return new OnlineMaxAbsoluteErrorCalculator(this); 102 } 103 104 public IDeepCloneable Clone(Cloner cloner) { 105 var clone = cloner.GetClone(this); 106 if (clone == null) { 107 clone = (IDeepCloneable)this.Clone(); 108 cloner.RegisterClonedObject(this, clone); 109 } 110 return clone; 111 } 90 112 } 91 113 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsoluteErrorCalculator.cs
r14185 r14293 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 private OnlineMeanAbsoluteErrorCalculator(OnlineMeanAbsoluteErrorCalculator other) { 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 = (IDeepCloneable)this.Clone(); 106 cloner.RegisterClonedObject(this, clone); 107 } 108 return clone; 109 } 89 110 } 90 111 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 42 private OnlineMeanAbsolutePercentageErrorCalculator(OnlineMeanAbsolutePercentageErrorCalculator other) { 43 sre = other.sre; 44 n = other.n; 45 errorState = other.errorState; 39 46 } 40 47 … … 89 96 } 90 97 } 98 99 // IDeepCloneable interface members 100 public object Clone() { 101 return new OnlineMeanAbsolutePercentageErrorCalculator(this); 102 } 103 104 public IDeepCloneable Clone(Cloner cloner) { 105 var clone = cloner.GetClone(this); 106 if (clone == null) { 107 clone = (IDeepCloneable)this.Clone(); 108 cloner.RegisterClonedObject(this, clone); 109 } 110 return clone; 111 } 91 112 } 92 113 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs
r14292 r14293 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 private OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator other) : this() { 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; … … 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 = (IDeepCloneable)this.Clone(); 129 cloner.RegisterClonedObject(this, clone); 130 } 131 return clone; 132 } 108 133 } 109 134 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanErrorCalculator.cs
r14185 r14293 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 private OnlineMeanErrorCalculator(OnlineMeanAndVarianceCalculator meanAndVarianceCalculator) { 40 this.meanAndVarianceCalculator = meanAndVarianceCalculator; 36 41 } 37 42 … … 74 79 } 75 80 } 81 82 // IDeepCloneable members 83 public object Clone() { 84 var meanAndVarianceCalculatorClone = (OnlineMeanAndVarianceCalculator)meanAndVarianceCalculator.Clone(); 85 return new OnlineMeanErrorCalculator(meanAndVarianceCalculatorClone); 86 } 87 88 public IDeepCloneable Clone(Cloner cloner) { 89 var clone = cloner.GetClone(this); 90 if (clone == null) { 91 var meanAndVarianceCalculatorClone = (OnlineMeanAndVarianceCalculator)meanAndVarianceCalculator.Clone(cloner); 92 clone = new OnlineMeanErrorCalculator(meanAndVarianceCalculatorClone); 93 cloner.RegisterClonedObject(this, clone); 94 } 95 return clone; 96 } 76 97 } 77 98 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 42 private OnlineMeanSquaredErrorCalculator(OnlineMeanSquaredErrorCalculator other) { 43 sse = other.sse; 44 n = other.n; 45 errorState = other.errorState; 38 46 } 39 47 … … 87 95 } 88 96 } 97 98 // IDeepCloneable members 99 public object Clone() { 100 return new OnlineMeanSquaredErrorCalculator(this); 101 } 102 103 public IDeepCloneable Clone(Cloner cloner) { 104 var clone = cloner.GetClone(this); 105 if (clone == null) { 106 clone = (IDeepCloneable)this.Clone(); 107 cloner.RegisterClonedObject(this, clone); 108 } 109 return clone; 110 } 89 111 } 90 112 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs
r14226 r14293 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 // private constructor used internally by the Clone() method 46 public OnlineNormalizedMeanSquaredErrorCalculator(OnlineMeanAndVarianceCalculator meanSquaredErrorCalculator, OnlineMeanAndVarianceCalculator originalVarianceCalculator) { 47 this.meanSquaredErrorCalculator = meanSquaredErrorCalculator; 48 this.originalVarianceCalculator = originalVarianceCalculator; 42 49 } 43 50 … … 92 99 } 93 100 } 101 102 // IDeepCloneable members 103 public object Clone() { 104 var meanSquaredErrorCalculatorClone = (OnlineMeanAndVarianceCalculator)meanSquaredErrorCalculator.Clone(); 105 var originalVarianceCalculatorClone = (OnlineMeanAndVarianceCalculator)originalVarianceCalculator.Clone(); 106 return new OnlineNormalizedMeanSquaredErrorCalculator(meanSquaredErrorCalculatorClone, originalVarianceCalculatorClone); 107 } 108 109 public IDeepCloneable Clone(Cloner cloner) { 110 var clone = cloner.GetClone(this); 111 if (clone == null) { 112 var meanSquaredErrorCalculatorClone = (OnlineMeanAndVarianceCalculator)meanSquaredErrorCalculator.Clone(cloner); 113 var originalVarianceCalculatorClone = (OnlineMeanAndVarianceCalculator)originalVarianceCalculator.Clone(cloner); 114 clone = new OnlineNormalizedMeanSquaredErrorCalculator(meanSquaredErrorCalculatorClone, originalVarianceCalculatorClone); 115 cloner.RegisterClonedObject(this, clone); 116 } 117 return clone; 118 } 94 119 } 95 120 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 50 private OnlinePearsonsRCalculator(OnlineCovarianceCalculator covCalculator, OnlineMeanAndVarianceCalculator sxCalculator, OnlineMeanAndVarianceCalculator syCalculator) { 51 this.covCalculator = covCalculator; 52 this.sxCalculator = sxCalculator; 53 this.syCalculator = syCalculator; 54 } 48 55 49 56 #region IOnlineCalculator Members … … 91 98 } 92 99 } 100 101 // IDeepCloneable members 102 public object Clone() { 103 var covCalculatorClone = (OnlineCovarianceCalculator)covCalculator.Clone(); 104 var sxCalculatorClone = (OnlineMeanAndVarianceCalculator)sxCalculator.Clone(); 105 var syCalculatorClone = (OnlineMeanAndVarianceCalculator)syCalculator.Clone(); 106 return new OnlinePearsonsRCalculator(covCalculatorClone, sxCalculatorClone, syCalculatorClone); 107 } 108 109 public IDeepCloneable Clone(Cloner cloner) { 110 var clone = cloner.GetClone(this); 111 if (clone == null) { 112 var covCalculatorClone = (OnlineCovarianceCalculator)covCalculator.Clone(cloner); 113 var sxCalculatorClone = (OnlineMeanAndVarianceCalculator)sxCalculator.Clone(cloner); 114 var syCalculatorClone = (OnlineMeanAndVarianceCalculator)syCalculator.Clone(cloner); 115 clone = new OnlinePearsonsRCalculator(covCalculatorClone, sxCalculatorClone, syCalculatorClone); 116 cloner.RegisterClonedObject(this, clone); 117 } 118 return clone; 119 } 93 120 } 94 121 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs
r14185 r14293 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 private OnlinePearsonsRSquaredCalculator(OnlinePearsonsRCalculator rCalculator) { 41 this.rCalculator = rCalculator; 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 rCalculatorClone = (OnlinePearsonsRCalculator)rCalculator.Clone(); 69 return new OnlinePearsonsRSquaredCalculator(rCalculatorClone); 70 } 71 72 public IDeepCloneable Clone(Cloner cloner) { 73 var clone = cloner.GetClone(this); 74 if (clone == null) { 75 var rCalculatorClone = (OnlinePearsonsRCalculator)rCalculator.Clone(cloner); 76 clone = new OnlinePearsonsRSquaredCalculator(rCalculatorClone); 77 cloner.RegisterClonedObject(this, clone); 78 } 79 return clone; 80 } 61 81 } 62 82 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineTheilsUStatisticCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 49 private OnlineTheilsUStatisticCalculator(OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator, OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator) { 50 this.squaredErrorMeanCalculator = squaredErrorMeanCalculator; 51 this.unbiasedEstimatorMeanCalculator = unbiasedEstimatorMeanCalculator; 45 52 } 46 53 … … 125 132 } 126 133 } 134 135 // IDeepCloneable members 136 public object Clone() { 137 var squaredErrorMeanCalculatorClone = (OnlineMeanAndVarianceCalculator)squaredErrorMeanCalculator.Clone(); 138 var unbiasedEstimatorMeanCalculatorClone = (OnlineMeanAndVarianceCalculator)unbiasedEstimatorMeanCalculator.Clone(); 139 return new OnlineTheilsUStatisticCalculator(squaredErrorMeanCalculatorClone, unbiasedEstimatorMeanCalculatorClone); 140 } 141 142 public IDeepCloneable Clone(Cloner cloner) { 143 var clone = cloner.GetClone(this); 144 if (clone == null) { 145 var squaredErrorMeanCalculatorClone = (OnlineMeanAndVarianceCalculator)squaredErrorMeanCalculator.Clone(cloner); 146 var unbiasedEstimatorMeanCalculatorClone = (OnlineMeanAndVarianceCalculator)unbiasedEstimatorMeanCalculator.Clone(cloner); 147 clone = new OnlineTheilsUStatisticCalculator(squaredErrorMeanCalculatorClone, unbiasedEstimatorMeanCalculatorClone); 148 cloner.RegisterClonedObject(this, clone); 149 } 150 return clone; 151 } 127 152 } 128 153 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedDirectionalSymmetryCalculator.cs
r14185 r14293 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 // private constructor used internally by the Clone() method 45 private OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator other) { 46 n = other.n; 47 correctSum = other.correctSum; 48 incorrectSum = other.incorrectSum; 49 errorState = other.errorState; 42 50 } 43 51 … … 118 126 } 119 127 } 128 129 // IDeepCloneable members 130 public object Clone() { 131 return new OnlineWeightedDirectionalSymmetryCalculator(this); 132 } 133 134 public IDeepCloneable Clone(Cloner cloner) { 135 var clone = cloner.GetClone(this); 136 if (clone == null) { 137 clone = (IDeepCloneable)this.Clone(); 138 cloner.RegisterClonedObject(this, clone); 139 } 140 return clone; 141 } 120 142 } 121 143 }
Note: See TracChangeset
for help on using the changeset viewer.