Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/11/21 12:26:27 (3 years ago)
Author:
chaider
Message:

#3140

  • Refactored ConstantOptimization ==> ParameterOptimization
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  
    9797
    9898    private const string ProblemDataParameterName = "ProblemData";
    99     private const string ConstantOptIterationsParameterName = "Constant optimization steps";
     99    private const string ParameterOptIterationsParameterName = "Parameter optimization steps";
    100100    private const string RestartsParameterName = "Restarts";
    101101
     
    108108      get { return (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
    109109    }
    110     public IFixedValueParameter<IntValue> ConstantOptIterationsParameter {
    111       get { return (IFixedValueParameter<IntValue>)Parameters[ConstantOptIterationsParameterName]; }
     110    public IFixedValueParameter<IntValue> ParameterOptIterationsParameter {
     111      get { return (IFixedValueParameter<IntValue>)Parameters[ParameterOptIterationsParameterName]; }
    112112    }
    113113    public IFixedValueParameter<IntValue> RestartsParameter {
     
    124124    IDataAnalysisProblemData IDataAnalysisProblem.ProblemData { get { return ProblemData; } }
    125125
    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; }
    129129    }
    130130
     
    153153      : base() {
    154154      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 constant optimization.", 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)));
    157157      Parameters["Restarts"].Hidden = true;
    158158      var g = new SimpleSymbolicExpressionGrammar();
     
    236236        double epsx = 0;
    237237        double stpmax = 1;
    238         int maxits = ConstantOptIterations;
     238        int maxits = ParameterOptIterations;
    239239        alglib.mincgstate state;
    240240        alglib.mincgreport rep;
     
    384384    [StorableHook(HookType.AfterDeserialization)]
    385385    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      }
    386394    }
    387395
  • branches/3140_NumberSymbol/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs

    r18100 r18113  
    263263      }
    264264
    265       if (!SymbolicRegressionConstantOptimizationEvaluator.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.");
    266266
    267267      // initialize constants randomly
     
    275275      var interpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
    276276
    277       SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, tree, problemData, problemData.TrainingIndices,
     277      SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, tree, problemData, problemData.TrainingIndices,
    278278        applyLinearScaling: applyLinearScaling, maxIterations: maxIterations,
    279         updateVariableWeights: false, updateConstantsInTree: true);
     279        updateVariableWeights: false, updateParametersInTree: true);
    280280
    281281      var model = new SymbolicRegressionModel(problemData.TargetVariable, tree, (ISymbolicDataAnalysisExpressionTreeInterpreter)interpreter.Clone());
Note: See TracChangeset for help on using the changeset viewer.