Changeset 15343 for branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelBuilder.cs
- Timestamp:
- 08/29/17 11:28:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/Operators/ModelBuilder.cs
r15338 r15343 32 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 33 using HeuristicLab.Problems.DataAnalysis; 34 using HeuristicLab.Problems.SurrogateProblem;35 34 36 35 namespace HeuristicLab.Algorithms.EGO { 37 /// <summary>38 /// A base class for operators that manipulate real-valued vectors.39 /// </summary>40 36 [Item("ModelBuilder", "Builds a model from a dataset and a given RegressionAlgorithm")] 41 37 [StorableClass] … … 120 116 solution = SanitizeGaussianProcess(oldSolution as GaussianProcessRegressionSolution, solution as GaussianProcessRegressionSolution, Cancellation); 121 117 122 if (regressionAlgorithm is M5RegressionTree && oldSolution != null) 123 solution = SanitizeM5Regression(oldSolution.Model as M5Model, solution, random, Cancellation); 118 //if (regressionAlgorithm is M5RegressionTree && oldSolution != null) solution = SanitizeM5Regression(oldSolution.Model as M5Model, solution, random, Cancellation); 124 119 125 120 … … 129 124 } 130 125 131 private static IRegressionSolution SanitizeM5Regression(M5Model oldmodel, IRegressionSolution newSolution, IRandom random, CancellationToken cancellation) {132 var problemdata = newSolution.ProblemData;133 oldmodel.UpdateLeafModels(problemdata, problemdata.AllIndices, random, cancellation);134 var oldSolution = oldmodel.CreateRegressionSolution(problemdata);135 var magicDecision = newSolution.TrainingRSquared < oldSolution.TrainingRSquared - 0.05;136 return magicDecision ? newSolution : oldmodel.CreateRegressionSolution(problemdata);137 }126 //private static IRegressionSolution SanitizeM5Regression(M5Model oldmodel, IRegressionSolution newSolution, IRandom random, CancellationToken cancellation) { 127 // var problemdata = newSolution.ProblemData; 128 // oldmodel.UpdateLeafModels(problemdata, problemdata.AllIndices, random, cancellation); 129 // var oldSolution = oldmodel.CreateRegressionSolution(problemdata); 130 // var magicDecision = newSolution.TrainingRSquared < oldSolution.TrainingRSquared - 0.05; 131 // return magicDecision ? newSolution : oldmodel.CreateRegressionSolution(problemdata); 132 //} 138 133 139 134 //try creating a model with old hyperparameters and new dataset; … … 150 145 newSolution = sol; 151 146 } 152 } catch (ArgumentException) { } 147 } 148 catch (ArgumentException) { } 153 149 return newSolution; 154 150 }
Note: See TracChangeset
for help on using the changeset viewer.