- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Analyzers/RegressionSolutionAnalyzer.cs
r4468 r4722 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 89 90 #endregion 90 91 92 93 [StorableConstructor] 94 protected RegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 95 protected RegressionSolutionAnalyzer(RegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 91 96 public RegressionSolutionAnalyzer() 92 97 : base() { … … 101 106 102 107 [StorableHook(HookType.AfterDeserialization)] 103 private void Initialize() {108 private void AfterDeserialization() { 104 109 // backwards compatibility 105 110 if (!Parameters.ContainsKey(GenerationsParameterName)) { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/LinearRegression/LinearRegressionSolutionCreator.cs
r4082 r4722 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; … … 39 40 [Item("LinearRegressionSolutionCreator", "Uses linear regression to create a structure tree.")] 40 41 [StorableClass] 41 public class LinearRegressionSolutionCreator : SingleSuccessorOperator, ISolutionCreator {42 public sealed class LinearRegressionSolutionCreator : SingleSuccessorOperator, ISolutionCreator { 42 43 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 43 44 private const string DataAnalysisProblemDataParameterName = "DataAnalysisProblemData"; … … 45 46 private const string SamplesEndParameterName = "SamplesEnd"; 46 47 48 [StorableConstructor] 49 private LinearRegressionSolutionCreator(bool deserializing) : base(deserializing) { } 50 private LinearRegressionSolutionCreator(LinearRegressionSolutionCreator original, Cloner cloner) : base(original, cloner) { } 47 51 public LinearRegressionSolutionCreator() { 48 52 Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The resulting solution encoded as a symbolic expression tree.")); … … 51 55 Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end of the samples on which the linear regression should be applied.")); 52 56 } 53 [StorableConstructor] 54 public LinearRegressionSolutionCreator(bool deserializing)55 : base(deserializing) {57 58 public override IDeepCloneable Clone(Cloner cloner) { 59 return new LinearRegressionSolutionCreator(this, cloner); 56 60 } 57 61 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/BestSupportVectorRegressionSolutionAnalyzer.cs
r4543 r4722 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 52 53 #endregion 53 54 55 [StorableConstructor] 56 private BestSupportVectorRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 57 private BestSupportVectorRegressionSolutionAnalyzer(BestSupportVectorRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 54 58 public BestSupportVectorRegressionSolutionAnalyzer() 55 59 : base() { 56 60 Parameters.Add(new ScopeTreeLookupParameter<SupportVectorMachineModel>(SupportVectorRegressionModelParameterName, "The support vector regression models to analyze.")); 57 61 Parameters.Add(new LookupParameter<SupportVectorRegressionSolution>(BestSolutionParameterName, "The best support vector regression solution.")); 62 } 63 64 public override IDeepCloneable Clone(Cloner cloner) { 65 return new BestSupportVectorRegressionSolutionAnalyzer(this, cloner); 58 66 } 59 67 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs
r4543 r4722 24 24 using System.Drawing; 25 25 using System.Linq; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 36 37 [StorableClass] 37 38 public sealed class SupportVectorRegressionSolution : DataAnalysisSolution { 38 public SupportVectorRegressionSolution() : base() { }39 public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)40 : base(problemData, lowerEstimationLimit, upperEstimationLimit) {41 this.Model = model;42 }43 44 39 public override Image ItemImage { 45 40 get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Function; } … … 53 48 public Dataset SupportVectors { 54 49 get { return CalculateSupportVectors(); } 50 } 51 52 private List<double> estimatedValues; 53 public override IEnumerable<double> EstimatedValues { 54 get { 55 if (estimatedValues == null) RecalculateEstimatedValues(); 56 return estimatedValues; 57 } 58 } 59 60 public override IEnumerable<double> EstimatedTrainingValues { 61 get { 62 return GetEstimatedValues(ProblemData.TrainingIndizes); 63 } 64 } 65 66 public override IEnumerable<double> EstimatedTestValues { 67 get { 68 return GetEstimatedValues(ProblemData.TestIndizes); 69 } 70 } 71 72 [StorableConstructor] 73 private SupportVectorRegressionSolution(bool deserializing) : base(deserializing) { } 74 private SupportVectorRegressionSolution(SupportVectorRegressionSolution original, Cloner cloner) : base(original, cloner) { } 75 public SupportVectorRegressionSolution() : base() { } 76 public SupportVectorRegressionSolution(DataAnalysisProblemData problemData, SupportVectorMachineModel model, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit) 77 : base(problemData, lowerEstimationLimit, upperEstimationLimit) { 78 this.Model = model; 79 } 80 81 public override IDeepCloneable Clone(Cloner cloner) { 82 return new SupportVectorRegressionSolution(this, cloner); 55 83 } 56 84 … … 83 111 } 84 112 85 private List<double> estimatedValues;86 public override IEnumerable<double> EstimatedValues {87 get {88 if (estimatedValues == null) RecalculateEstimatedValues();89 return estimatedValues;90 }91 }92 93 public override IEnumerable<double> EstimatedTrainingValues {94 get {95 return GetEstimatedValues(ProblemData.TrainingIndizes);96 }97 }98 99 public override IEnumerable<double> EstimatedTestValues {100 get {101 return GetEstimatedValues(ProblemData.TestIndizes);102 }103 }104 113 105 114 private IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/BestSymbolicRegressionSolutionAnalyzer.cs
r4468 r4722 22 22 using System.Linq; 23 23 using HeuristicLab.Analysis; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 67 68 #endregion 68 69 70 [StorableConstructor] 71 private BestSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 72 private BestSymbolicRegressionSolutionAnalyzer(BestSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 69 73 public BestSymbolicRegressionSolutionAnalyzer() 70 74 : base() { … … 75 79 } 76 80 81 public override IDeepCloneable Clone(Cloner cloner) { 82 return new BestSymbolicRegressionSolutionAnalyzer(this, cloner); 83 } 84 77 85 [StorableHook(HookType.AfterDeserialization)] 78 private void Initialize() {86 private void AfterDeserialization() { 79 87 if (!Parameters.ContainsKey(VariableFrequenciesParameterName)) { 80 88 Parameters.Add(new LookupParameter<DataTable>(VariableFrequenciesParameterName, "The variable frequencies table to use for the calculation of variable impacts")); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
r4468 r4722 23 23 using System.Linq; 24 24 using HeuristicLab.Analysis; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; … … 165 166 #endregion 166 167 168 [StorableConstructor] 169 private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 170 private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 167 171 public FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer() 168 172 : base() { … … 186 190 } 187 191 188 [StorableConstructor] 189 private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base() { } 192 public override IDeepCloneable Clone(Cloner cloner) { 193 return new FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(this, cloner); 194 } 190 195 191 196 [StorableHook(HookType.AfterDeserialization)] -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityAnalyzer.cs
r4468 r4722 24 24 using System.Linq; 25 25 using HeuristicLab.Analysis; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Data; … … 118 119 #endregion 119 120 121 [StorableConstructor] 122 private SymbolicRegressionModelQualityAnalyzer(bool deserializing) : base(deserializing) { } 123 private SymbolicRegressionModelQualityAnalyzer(SymbolicRegressionModelQualityAnalyzer original, Cloner cloner) : base(original, cloner) { } 120 124 public SymbolicRegressionModelQualityAnalyzer() 121 125 : base() { … … 131 135 } 132 136 133 [StorableConstructor] 134 private SymbolicRegressionModelQualityAnalyzer(bool deserializing) : base() { } 137 public override IDeepCloneable Clone(Cloner cloner) { 138 return new SymbolicRegressionModelQualityAnalyzer(this, cloner); 139 } 135 140 136 141 public override IOperation Apply() { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionModelQualityCalculator.cs
r4468 r4722 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 83 84 #endregion 84 85 86 [StorableConstructor] 87 private SymbolicRegressionModelQualityCalculator(bool deserializing) : base(deserializing) { } 88 private SymbolicRegressionModelQualityCalculator(SymbolicRegressionModelQualityCalculator original, Cloner cloner) : base(original, cloner) { } 85 89 public SymbolicRegressionModelQualityCalculator() 86 90 : base() { … … 138 142 139 143 } 144 public override IDeepCloneable Clone(Cloner cloner) { 145 return new SymbolicRegressionModelQualityCalculator(this, cloner); 146 } 140 147 } 141 148 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionSolutionLinearScaler.cs
r4068 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 53 54 } 54 55 56 [StorableConstructor] 57 private SymbolicRegressionSolutionLinearScaler(bool deserializing) : base(deserializing) { } 58 private SymbolicRegressionSolutionLinearScaler(SymbolicRegressionSolutionLinearScaler original, Cloner cloner) : base(original, cloner) { } 55 59 public SymbolicRegressionSolutionLinearScaler() 56 60 : base() { … … 59 63 Parameters.Add(new LookupParameter<DoubleValue>(AlphaParameterName, "Alpha parameter for linear transformation.")); 60 64 Parameters.Add(new LookupParameter<DoubleValue>(BetaParameterName, "Beta parameter for linear transformation.")); 65 } 66 67 public override IDeepCloneable Clone(Cloner cloner) { 68 return new SymbolicRegressionSolutionLinearScaler(this, cloner); 61 69 } 62 70 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionTournamentPruning.cs
r4468 r4722 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 33 34 34 35 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers { 35 public class SymbolicRegressionTournamentPruning : SingleSuccessorOperator, ISymbolicRegressionAnalyzer {36 public sealed class SymbolicRegressionTournamentPruning : SingleSuccessorOperator, ISymbolicRegressionAnalyzer { 36 37 private const string RandomParameterName = "Random"; 37 38 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; … … 176 177 } 177 178 #endregion 178 protected SymbolicRegressionTournamentPruning(bool deserializing) : base(deserializing) { } 179 180 [StorableConstructor] 181 private SymbolicRegressionTournamentPruning(bool deserializing) : base(deserializing) { } 182 private SymbolicRegressionTournamentPruning(SymbolicRegressionTournamentPruning original, Cloner cloner) : base(original, cloner) { } 179 183 public SymbolicRegressionTournamentPruning() 180 184 : base() { … … 201 205 } 202 206 207 public override IDeepCloneable Clone(Cloner cloner) { 208 return new SymbolicRegressionTournamentPruning(this, cloner); 209 } 210 203 211 [StorableHook(HookType.AfterDeserialization)] 204 212 private void AfterDeserialization() { … … 241 249 double lowerEstimationLimit, double upperEstimationLimit, 242 250 double maxPruningRatio, double qualityGainWeight) { 243 244 251 IEnumerable<int> rows = Enumerable.Range(samplesStart, samplesEnd - samplesStart) 252 .Where(i => i < problemData.TestSamplesStart.Value || problemData.TestSamplesEnd.Value <= i); 245 253 int originalSize = tree.Size; 246 254 double originalQuality = evaluator.Evaluate(interpreter, tree, -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionVariableFrequencyAnalyzer.cs
r4068 r4722 22 22 using System.Linq; 23 23 using HeuristicLab.Analysis; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 60 61 #endregion 61 62 63 [StorableConstructor] 64 private SymbolicRegressionVariableFrequencyAnalyzer(bool deserializing) : base(deserializing) { } 65 private SymbolicRegressionVariableFrequencyAnalyzer(SymbolicRegressionVariableFrequencyAnalyzer original, Cloner cloner) : base(original, cloner) { } 62 66 public SymbolicRegressionVariableFrequencyAnalyzer() 63 67 : base() { … … 66 70 Parameters.Add(new ValueLookupParameter<DataTable>(VariableFrequenciesParameterName, "The data table to store the variable frequencies.")); 67 71 Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection where the best symbolic regression solution should be stored.")); 72 } 73 74 public override IDeepCloneable Clone(Cloner cloner) { 75 return new SymbolicRegressionVariableFrequencyAnalyzer(this, cloner); 68 76 } 69 77 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/ValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
r4468 r4722 135 135 private ResultsCollector resultsCollector; 136 136 137 [StorableConstructor] 138 private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 139 private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(ValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) 140 : base(original, cloner) { 141 Initialize(); 142 } 137 143 public ValidationBestScaledSymbolicRegressionSolutionAnalyzer() 138 144 : base() { … … 249 255 } 250 256 251 [StorableConstructor] 252 private ValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base() { } 257 public override IDeepCloneable Clone(Cloner cloner) { 258 return new ValidationBestScaledSymbolicRegressionSolutionAnalyzer(this, cloner); 259 } 253 260 254 261 [StorableHook(HookType.AfterDeserialization)] 262 private void AfterDeserialization() { 263 Initialize(); 264 } 255 265 private void Initialize() { 256 266 SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged); 257 267 } 258 268 259 public override IDeepCloneable Clone(Cloner cloner) {260 ValidationBestScaledSymbolicRegressionSolutionAnalyzer clone = (ValidationBestScaledSymbolicRegressionSolutionAnalyzer)base.Clone(cloner);261 clone.Initialize();262 return clone;263 }264 269 265 270 private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionEvaluator.cs
r4468 r4722 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 102 103 #endregion 103 104 105 [StorableConstructor] 106 protected MultiObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { } 107 protected MultiObjectiveSymbolicRegressionEvaluator(MultiObjectiveSymbolicRegressionEvaluator original, Cloner cloner) : base(original, cloner) { } 104 108 public MultiObjectiveSymbolicRegressionEvaluator() 105 109 : base() { … … 112 116 Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end index of the dataset partition on which the symbolic regression solution should be evaluated.")); 113 117 Parameters.Add(new ValueParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation between the start and end index.", new PercentValue(1))); 114 }115 116 [StorableConstructor]117 protected MultiObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { }118 [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)]119 private void AfterDeserialization() {120 118 } 121 119 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator.cs
r4166 r4722 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Data; … … 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Problems.DataAnalysis.Evaluators;30 29 using HeuristicLab.Problems.DataAnalysis.Symbolic; 31 30 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols; … … 34 33 [Item("MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator", "Calculates the mean squared error and the number of variables of a symbolic regression solution.")] 35 34 [StorableClass] 36 public class MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator : MultiObjectiveSymbolicRegressionEvaluator {35 public sealed class MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator : MultiObjectiveSymbolicRegressionEvaluator { 37 36 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 38 37 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; … … 54 53 } 55 54 #endregion 55 [StorableConstructor] 56 private MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { } 57 private MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator original, Cloner cloner) 58 : base(original, cloner) { 59 } 56 60 public MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator() 57 61 : base() { 58 62 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees.")); 59 63 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees.")); 64 } 65 66 public override IDeepCloneable Clone(Cloner cloner) { 67 return new MultiObjectiveSymbolicRegressionMeanSquaredErrorEvaluator(this, cloner); 60 68 } 61 69 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator.cs
r4128 r4722 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Data; … … 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Problems.DataAnalysis.Evaluators;30 29 using HeuristicLab.Problems.DataAnalysis.Symbolic; 31 30 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols; … … 34 33 [Item("MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator", "Calculates the correlation coefficient r² and the number of variables of a symbolic regression solution.")] 35 34 [StorableClass] 36 public class MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator : MultiObjectiveSymbolicRegressionEvaluator {35 public sealed class MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator : MultiObjectiveSymbolicRegressionEvaluator { 37 36 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 38 37 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; … … 54 53 } 55 54 #endregion 55 [StorableConstructor] 56 private MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { } 57 private MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner) 58 : base(original, cloner) { 59 } 56 60 public MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator() 57 61 : base() { 58 62 Parameters.Add(new ValueLookupParameter<DoubleValue>(UpperEstimationLimitParameterName, "The upper limit that should be used as cut off value for the output values of symbolic expression trees.")); 59 63 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees.")); 64 } 65 66 public override IDeepCloneable Clone(Cloner cloner) { 67 return new MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(this, cloner); 60 68 } 61 69 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SingleObjectiveSymbolicRegressionEvaluator.cs
r4468 r4722 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; … … 115 116 #endregion 116 117 118 [StorableConstructor] 119 protected SingleObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { } 120 protected SingleObjectiveSymbolicRegressionEvaluator(SingleObjectiveSymbolicRegressionEvaluator original, Cloner cloner) 121 : base(original, cloner) { 122 } 117 123 public SingleObjectiveSymbolicRegressionEvaluator() 118 124 : base() { … … 129 135 } 130 136 131 [StorableConstructor] 132 protected SingleObjectiveSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { } 137 133 138 [StorableHook(Persistence.Default.CompositeSerializers.Storable.HookType.AfterDeserialization)] 134 139 private void AfterDeserialization() { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionMeanSquaredErrorEvaluator.cs
r4190 r4722 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Parameters;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 using HeuristicLab.Problems.DataAnalysis.Evaluators; … … 35 34 public class SymbolicRegressionMeanSquaredErrorEvaluator : SingleObjectiveSymbolicRegressionEvaluator { 36 35 37 public SymbolicRegressionMeanSquaredErrorEvaluator() 38 : base() { 36 [StorableConstructor] 37 protected SymbolicRegressionMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { } 38 protected SymbolicRegressionMeanSquaredErrorEvaluator(SymbolicRegressionMeanSquaredErrorEvaluator original, Cloner cloner) 39 : base(original, cloner) { 40 } 41 public SymbolicRegressionMeanSquaredErrorEvaluator() : base() { } 42 43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new SymbolicRegressionMeanSquaredErrorEvaluator(this, cloner); 39 45 } 40 46 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionPearsonsRSquaredEvaluator.cs
r4190 r4722 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Parameters;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 using HeuristicLab.Problems.DataAnalysis.Evaluators; … … 34 33 [StorableClass] 35 34 public class SymbolicRegressionPearsonsRSquaredEvaluator : SingleObjectiveSymbolicRegressionEvaluator { 36 public SymbolicRegressionPearsonsRSquaredEvaluator() 37 : base() { 35 [StorableConstructor] 36 protected SymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { } 37 protected SymbolicRegressionPearsonsRSquaredEvaluator(SymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner) 38 : base(original, cloner) { 38 39 } 40 public SymbolicRegressionPearsonsRSquaredEvaluator() : base() { } 39 41 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new SymbolicRegressionPearsonsRSquaredEvaluator(this, cloner); 44 } 40 45 public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) { 41 46 double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator.cs
r4190 r4722 34 34 [Item("SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator", "Calculates the mean and the variance of the squared errors of a linearly scaled symbolic regression solution.")] 35 35 [StorableClass] 36 public class SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {36 public sealed class SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator { 37 37 private const string QualityVarianceParameterName = "QualityVariance"; 38 38 private const string QualitySamplesParameterName = "QualitySamples"; … … 90 90 } 91 91 #endregion 92 [StorableConstructor] 93 private SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(bool deserializing) : base(deserializing) { } 94 private SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { } 92 95 public SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator() 93 96 : base() { … … 100 103 Parameters.Add(new LookupParameter<DoubleValue>(DecompositionVarianceParameterName, "A parameter which stores the relativ bias of the MSE.")); 101 104 Parameters.Add(new LookupParameter<DoubleValue>(DecompositionCovarianceParameterName, "A parameter which stores the relativ bias of the MSE.")); 105 } 106 107 public override IDeepCloneable Clone(Cloner cloner) { 108 return new SymbolicRegressionScaledMeanAndVarianceSquaredErrorEvaluator(this, cloner); 102 109 } 103 110 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionScaledMeanSquaredErrorEvaluator.cs
r4477 r4722 34 34 [Item("SymbolicRegressionScaledMeanSquaredErrorEvaluator", "Calculates the mean squared error of a linearly scaled symbolic regression solution.")] 35 35 [StorableClass] 36 public class SymbolicRegressionScaledMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator {36 public sealed class SymbolicRegressionScaledMeanSquaredErrorEvaluator : SymbolicRegressionMeanSquaredErrorEvaluator { 37 37 38 38 #region parameter properties … … 54 54 } 55 55 #endregion 56 [StorableConstructor] 57 private SymbolicRegressionScaledMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { } 58 private SymbolicRegressionScaledMeanSquaredErrorEvaluator(SymbolicRegressionScaledMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { } 56 59 public SymbolicRegressionScaledMeanSquaredErrorEvaluator() 57 60 : base() { 58 61 Parameters.Add(new LookupParameter<DoubleValue>("Alpha", "Alpha parameter for linear scaling of the estimated values.")); 59 62 Parameters.Add(new LookupParameter<DoubleValue>("Beta", "Beta parameter for linear scaling of the estimated values.")); 63 } 64 65 public override IDeepCloneable Clone(Cloner cloner) { 66 return new SymbolicRegressionScaledMeanSquaredErrorEvaluator(this, cloner); 60 67 } 61 68 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Interfaces/ISymbolicRegressionEvaluator.cs
r4190 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 25 26 using HeuristicLab.Optimization; 26 27 using HeuristicLab.Problems.DataAnalysis.Symbolic; 27 using System.Collections.Generic;28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/MultiObjectiveSymbolicRegressionProblem.cs
r4545 r4722 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Core; 27 25 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;32 26 using HeuristicLab.Optimization; 33 27 using HeuristicLab.Parameters; 34 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 35 using HeuristicLab.PluginInfrastructure;36 using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers;37 using HeuristicLab.Problems.DataAnalysis.Symbolic;38 29 39 30 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic { … … 71 62 #endregion 72 63 73 74 64 [StorableConstructor] 75 65 protected MultiObjectiveSymbolicRegressionProblem(bool deserializing) : base(deserializing) { } 66 protected MultiObjectiveSymbolicRegressionProblem(MultiObjectiveSymbolicRegressionProblem original, Cloner cloner) 67 : base(original, cloner) { 68 RegisterParameterEvents(); 69 RegisterParameterValueEvents(); 70 } 76 71 public MultiObjectiveSymbolicRegressionProblem() 77 72 : base() { … … 89 84 90 85 public override IDeepCloneable Clone(Cloner cloner) { 91 MultiObjectiveSymbolicRegressionProblem clone = (MultiObjectiveSymbolicRegressionProblem)base.Clone(cloner); 92 clone.RegisterParameterEvents(); 93 clone.RegisterParameterValueEvents(); 94 return clone; 86 return new MultiObjectiveSymbolicRegressionProblem(this, cloner); 95 87 } 96 88 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SimpleSymbolicRegressionEvaluator.cs
r4068 r4722 22 22 using System; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 33 34 [Item("SimpleSymbolicRegressionEvaluator", "Evaluates a symbolic regression solution and outputs a matrix of target and estimated values.")] 34 35 [StorableClass] 35 public class SimpleSymbolicRegressionEvaluator : SingleSuccessorOperator {36 public sealed class SimpleSymbolicRegressionEvaluator : SingleSuccessorOperator { 36 37 private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter"; 37 38 private const string FunctionTreeParameterName = "FunctionTree"; … … 100 101 #endregion 101 102 103 [StorableConstructor] 104 private SimpleSymbolicRegressionEvaluator(bool deserializing) : base(deserializing) { } 105 private SimpleSymbolicRegressionEvaluator(SimpleSymbolicRegressionEvaluator original, Cloner cloner) : base(original, cloner) { } 102 106 public SimpleSymbolicRegressionEvaluator() 103 107 : base() { … … 110 114 Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower limit that should be used as cut off value for the output values of symbolic expression trees.")); 111 115 Parameters.Add(new LookupParameter<DoubleMatrix>(ValuesParameterName, "The matrix of target and estimated values as generated by the symbolic regression solution.")); 116 } 117 118 public override IDeepCloneable Clone(Cloner cloner) { 119 return new SimpleSymbolicRegressionEvaluator(this, cloner); 112 120 } 113 121 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs
r4468 r4722 32 32 [StorableClass] 33 33 [Item("SymbolicRegressionModel", "A symbolic regression model represents an entity that provides estimated values based on input values.")] 34 public class SymbolicRegressionModel : NamedItem, IDataAnalysisModel { 35 private SymbolicRegressionModel() : base() { } // for cloning 34 public sealed class SymbolicRegressionModel : NamedItem, IDataAnalysisModel { 36 35 [StorableConstructor] 37 protected SymbolicRegressionModel(bool deserializing) 38 : base(deserializing) { 36 private SymbolicRegressionModel(bool deserializing) : base(deserializing) { } 37 private SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner) 38 : base(original, cloner) { 39 tree = (SymbolicExpressionTree)cloner.Clone(original.tree); 40 interpreter = (ISymbolicExpressionTreeInterpreter)cloner.Clone(original.interpreter); 41 inputVariables = new List<string>(original.inputVariables); 39 42 } 43 40 44 public SymbolicRegressionModel(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree tree) 41 45 : base() { … … 45 49 } 46 50 51 public override IDeepCloneable Clone(Cloner cloner) { 52 return new SymbolicRegressionModel(this, cloner); 53 } 54 47 55 [StorableHook(HookType.AfterDeserialization)] 48 private void AfterDeserialization Hook() {56 private void AfterDeserialization() { 49 57 if (inputVariables == null) 50 58 this.inputVariables = tree.IterateNodesPrefix().OfType<VariableTreeNode>().Select(var => var.VariableName).Distinct().ToList(); … … 73 81 return interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, rows); 74 82 } 75 76 public override IDeepCloneable Clone(Cloner cloner) {77 var clone = (SymbolicRegressionModel)base.Clone(cloner);78 clone.tree = (SymbolicExpressionTree)cloner.Clone(tree);79 clone.interpreter = (ISymbolicExpressionTreeInterpreter)cloner.Clone(interpreter);80 clone.inputVariables = new List<string>(inputVariables);81 return clone;82 }83 83 } 84 84 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
r4562 r4722 34 34 [Creatable("Problems")] 35 35 [StorableClass] 36 public class SymbolicRegressionProblem : SymbolicRegressionProblemBase, ISingleObjectiveDataAnalysisProblem {36 public sealed class SymbolicRegressionProblem : SymbolicRegressionProblemBase, ISingleObjectiveDataAnalysisProblem { 37 37 38 38 #region Parameter Properties … … 74 74 75 75 [StorableConstructor] 76 protected SymbolicRegressionProblem(bool deserializing) : base(deserializing) { } 76 private SymbolicRegressionProblem(bool deserializing) : base(deserializing) { } 77 private SymbolicRegressionProblem(SymbolicRegressionProblem original, Cloner cloner) 78 : base(original, cloner) { 79 RegisterParameterEvents(); 80 RegisterParameterValueEvents(); 81 } 82 77 83 public SymbolicRegressionProblem() 78 84 : base() { … … 92 98 93 99 public override IDeepCloneable Clone(Cloner cloner) { 94 SymbolicRegressionProblem clone = (SymbolicRegressionProblem)base.Clone(cloner); 95 clone.RegisterParameterEvents(); 96 clone.RegisterParameterValueEvents(); 97 return clone; 100 return new SymbolicRegressionProblem(this, cloner); 98 101 } 99 102 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs
r4486 r4722 130 130 get { 131 131 int endIndex = (int)(DataAnalysisProblemData.TrainingIndizes.Count() * (1.0 - DataAnalysisProblemData.ValidationPercentage.Value) - 1); 132 if (endIndex < 0) endIndex = 0; 132 if (endIndex < 0) endIndex = 0; 133 133 return new IntValue(DataAnalysisProblemData.TrainingIndizes.ElementAt(endIndex)); 134 134 } … … 153 153 [StorableConstructor] 154 154 protected SymbolicRegressionProblemBase(bool deserializing) : base(deserializing) { } 155 protected SymbolicRegressionProblemBase(SymbolicRegressionProblemBase original, Cloner cloner) 156 : base(original, cloner) { 157 operators = original.operators.Select(x => (IOperator)cloner.Clone(x)).ToList(); 158 RegisterParameterEvents(); 159 RegisterParameterValueEvents(); 160 } 155 161 public SymbolicRegressionProblemBase() 156 162 : base() { … … 178 184 RegisterParameterEvents(); 179 185 RegisterParameterValueEvents(); 180 }181 182 public override IDeepCloneable Clone(Cloner cloner) {183 SymbolicRegressionProblemBase clone = (SymbolicRegressionProblemBase)base.Clone(cloner);184 clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();185 clone.RegisterParameterEvents();186 clone.RegisterParameterValueEvents();187 return clone;188 186 } 189 187 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
r4468 r4722 24 24 using System.Drawing; 25 25 using System.Linq; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 35 36 [StorableClass] 36 37 public class SymbolicRegressionSolution : DataAnalysisSolution { 37 public SymbolicRegressionSolution() : base() { }38 public SymbolicRegressionSolution(DataAnalysisProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)39 : base(problemData, lowerEstimationLimit, upperEstimationLimit) {40 this.Model = model;41 }42 43 38 public override Image ItemImage { 44 39 get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Function; } … … 48 43 get { return (SymbolicRegressionModel)base.Model; } 49 44 set { base.Model = value; } 50 }51 52 protected override void RecalculateEstimatedValues() {53 int minLag = 0;54 var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>();55 if (laggedTreeNodes.Any())56 minLag = laggedTreeNodes.Min(node => node.Lag);57 IEnumerable<double> calculatedValues =58 from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows)59 let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x))60 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX;61 estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList();62 OnEstimatedValuesChanged();63 45 } 64 46 … … 79 61 } 80 62 63 [StorableConstructor] 64 protected SymbolicRegressionSolution(bool deserializing) : base(deserializing) { } 65 protected SymbolicRegressionSolution(SymbolicRegressionSolution original, Cloner cloner) 66 : base(original, cloner) { 67 } 68 public SymbolicRegressionSolution(DataAnalysisProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit) 69 : base(problemData, lowerEstimationLimit, upperEstimationLimit) { 70 this.Model = model; 71 } 72 73 public override IDeepCloneable Clone(Cloner cloner) { 74 return new SymbolicRegressionSolution(this, cloner); 75 } 76 77 protected override void RecalculateEstimatedValues() { 78 int minLag = 0; 79 var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>(); 80 if (laggedTreeNodes.Any()) 81 minLag = laggedTreeNodes.Min(node => node.Lag); 82 IEnumerable<double> calculatedValues = 83 from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows) 84 let boundedX = Math.Min(UpperEstimationLimit, Math.Max(LowerEstimationLimit, x)) 85 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX; 86 estimatedValues = Enumerable.Repeat(double.NaN, Math.Abs(minLag)).Concat(calculatedValues).ToList(); 87 OnEstimatedValuesChanged(); 88 } 89 81 90 public virtual IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) { 82 91 if (estimatedValues == null) RecalculateEstimatedValues();
Note: See TracChangeset
for help on using the changeset viewer.