Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/17/15 11:47:52 (8 years ago)
Author:
gkronber
Message:

#2385: added CreateSolution flag to Gaussian process algorithms

File:
1 edited

Legend:

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

    r12012 r13205  
    4040    private const string TrainingRSquaredResultName = "Training R²";
    4141    private const string TestRSquaredResultName = "Test R²";
     42    private const string CreateSolutionParameterName = "CreateSolution";
    4243
    4344    #region Parameter Properties
     
    5455      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
    5556    }
     57    public ILookupParameter<BoolValue> CreateSolutionParameter {
     58      get { return (ILookupParameter<BoolValue>)Parameters[CreateSolutionParameterName]; }
     59    }
    5660    #endregion
    5761
     
    6468      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The regression problem data for the Gaussian process solution."));
    6569      Parameters.Add(new LookupParameter<IGaussianProcessModel>(ModelParameterName, "The Gaussian process regression model to use for the solution."));
     70      Parameters.Add(new LookupParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run"));
     71
    6672      // in & out
    6773      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection of the algorithm."));
    6874      // out
    6975      Parameters.Add(new LookupParameter<IGaussianProcessSolution>(SolutionParameterName, "The produced Gaussian process solution."));
     76    }
     77
     78    [StorableHook(HookType.AfterDeserialization)]
     79    private void AfterDeserialization() {
     80      // BackwardsCompatibility3.3
     81      #region Backwards compatible code, remove with 3.4
     82      if (!Parameters.ContainsKey(CreateSolutionParameterName)) {
     83        Parameters.Add(new LookupParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run"));
     84      }
     85      #endregion
    7086    }
    7187
     
    7591
    7692    public override IOperation Apply() {
    77       if (ModelParameter.ActualValue != null) {
     93      if (ModelParameter.ActualValue != null && CreateSolutionParameter.ActualValue.Value == true) {
    7894        var m = (IGaussianProcessModel)ModelParameter.ActualValue.Clone();
    7995        m.FixParameters();
Note: See TracChangeset for help on using the changeset viewer.