- Timestamp:
- 12/11/21 12:26:27 (3 years ago)
- Location:
- branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs
r17180 r18113 97 97 98 98 private const string ProblemDataParameterName = "ProblemData"; 99 private const string ConstantOptIterationsParameterName = "Constantoptimization steps";99 private const string ParameterOptIterationsParameterName = "Parameter optimization steps"; 100 100 private const string RestartsParameterName = "Restarts"; 101 101 … … 108 108 get { return (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; } 109 109 } 110 public IFixedValueParameter<IntValue> ConstantOptIterationsParameter {111 get { return (IFixedValueParameter<IntValue>)Parameters[ ConstantOptIterationsParameterName]; }110 public IFixedValueParameter<IntValue> ParameterOptIterationsParameter { 111 get { return (IFixedValueParameter<IntValue>)Parameters[ParameterOptIterationsParameterName]; } 112 112 } 113 113 public IFixedValueParameter<IntValue> RestartsParameter { … … 124 124 IDataAnalysisProblemData IDataAnalysisProblem.ProblemData { get { return ProblemData; } } 125 125 126 public int ConstantOptIterations {127 get { return ConstantOptIterationsParameter.Value.Value; }128 set { ConstantOptIterationsParameter.Value.Value = value; }126 public int ParameterOptIterations { 127 get { return ParameterOptIterationsParameter.Value.Value; } 128 set { ParameterOptIterationsParameter.Value.Value = value; } 129 129 } 130 130 … … 153 153 : base() { 154 154 Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "The data for the regression problem", new RegressionProblemData())); 155 Parameters.Add(new FixedValueParameter<IntValue>( ConstantOptIterationsParameterName, "Number of optimization steps for hyperparameter values", new IntValue(50)));156 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of random restarts for constantoptimization.", new IntValue(10)));155 Parameters.Add(new FixedValueParameter<IntValue>(ParameterOptIterationsParameterName, "Number of optimization steps for hyperparameter values", new IntValue(50))); 156 Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of random restarts for parameter optimization.", new IntValue(10))); 157 157 Parameters["Restarts"].Hidden = true; 158 158 var g = new SimpleSymbolicExpressionGrammar(); … … 236 236 double epsx = 0; 237 237 double stpmax = 1; 238 int maxits = ConstantOptIterations;238 int maxits = ParameterOptIterations; 239 239 alglib.mincgstate state; 240 240 alglib.mincgreport rep; … … 384 384 [StorableHook(HookType.AfterDeserialization)] 385 385 private void AfterDeserialization() { 386 if (!Parameters.ContainsKey(ParameterOptIterationsParameterName)) { 387 if (Parameters.ContainsKey("Constant optimization steps")) { 388 Parameters.Add(new FixedValueParameter<IntValue>(ParameterOptIterationsParameterName, "Number of optimization steps for hyperparameter values", (IntValue)Parameters["Constant optimization steps"].ActualValue)); 389 Parameters.Remove("Constant optimization steps"); 390 } else { 391 Parameters.Add(new FixedValueParameter<IntValue>(ParameterOptIterationsParameterName, "Number of optimization steps for hyperparameter values", new IntValue(50))); 392 } 393 } 386 394 } 387 395 -
branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs
r18100 r18113 263 263 } 264 264 265 if (!SymbolicRegression ConstantOptimizationEvaluator.CanOptimizeConstants(tree)) throw new ArgumentException("The optimizer does not support the specified model structure.");265 if (!SymbolicRegressionParameterOptimizationEvaluator.CanOptimizeParameters(tree)) throw new ArgumentException("The optimizer does not support the specified model structure."); 266 266 267 267 // initialize constants randomly … … 275 275 var interpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter(); 276 276 277 SymbolicRegression ConstantOptimizationEvaluator.OptimizeConstants(interpreter, tree, problemData, problemData.TrainingIndices,277 SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, tree, problemData, problemData.TrainingIndices, 278 278 applyLinearScaling: applyLinearScaling, maxIterations: maxIterations, 279 updateVariableWeights: false, update ConstantsInTree: true);279 updateVariableWeights: false, updateParametersInTree: true); 280 280 281 281 var model = new SymbolicRegressionModel(problemData.TargetVariable, tree, (ISymbolicDataAnalysisExpressionTreeInterpreter)interpreter.Clone());
Note: See TracChangeset
for help on using the changeset viewer.