Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17427


Ignore:
Timestamp:
02/06/20 17:08:41 (5 years ago)
Author:
fholzing
Message:

#2812: Changed type of MeanFunctionParameter and CovarianceFunctionParameter from IValueParameter to IConstrainedValueParameter (+ initialization)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessBase.cs

    r17180 r17427  
    2222
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Algorithms.GradientDescent;
    2526using HeuristicLab.Common;
     
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Parameters;
    31 using HEAL.Attic;
     32using HeuristicLab.PluginInfrastructure;
    3233using HeuristicLab.Problems.DataAnalysis;
    3334
     
    5758
    5859    #region parameter properties
    59     public IValueParameter<IMeanFunction> MeanFunctionParameter {
    60       get { return (IValueParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
    61     }
    62     public IValueParameter<ICovarianceFunction> CovarianceFunctionParameter {
    63       get { return (IValueParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
     60    public IConstrainedValueParameter<IMeanFunction> MeanFunctionParameter {
     61      get { return (IConstrainedValueParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
     62    }
     63    public IConstrainedValueParameter<ICovarianceFunction> CovarianceFunctionParameter {
     64      get { return (IConstrainedValueParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
    6465    }
    6566    public IValueParameter<IntValue> MinimizationIterationsParameter {
     
    106107      : base() {
    107108      Problem = problem;
    108       Parameters.Add(new ValueParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function to use.", new MeanConst()));
    109       Parameters.Add(new ValueParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function to use.", new CovarianceSquaredExponentialIso()));
     109      Parameters.Add(new ConstrainedValueParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function to use."));
     110      Parameters.Add(new ConstrainedValueParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function to use."));
    110111      Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization with LM-BFGS.", new IntValue(20)));
    111112      Parameters.Add(new ValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
     
    193194
    194195      solutionCreator.OperatorParameter.ActualName = SolutionCreatorParameterName;
     196
     197      foreach (var meanfunction in ApplicationManager.Manager.GetInstances<IMeanFunction>().OrderBy(s => s.ItemName))
     198        MeanFunctionParameter.ValidValues.Add(meanfunction);
     199
     200      var defaultMeanFunction = MeanFunctionParameter.ValidValues.OfType<MeanConst>().FirstOrDefault();
     201      if (defaultMeanFunction != null) {
     202        MeanFunctionParameter.Value = defaultMeanFunction;
     203      }
     204
     205      foreach (var covarianceFunction in ApplicationManager.Manager.GetInstances<ICovarianceFunction>().OrderBy(s => s.ItemName))
     206        CovarianceFunctionParameter.ValidValues.Add(covarianceFunction);
     207
     208      var defaultCovarianceFunctionParameter = CovarianceFunctionParameter.ValidValues.OfType<CovarianceSquaredExponentialIso>().FirstOrDefault();
     209      if (defaultCovarianceFunctionParameter != null) {
     210        CovarianceFunctionParameter.Value = defaultCovarianceFunctionParameter;
     211      }
    195212    }
    196213
Note: See TracChangeset for help on using the changeset viewer.