Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/11/18 10:51:52 (6 years ago)
Author:
fholzing
Message:

#2883: Implemented Review-Points (Renamed ModelStorage to ModelCreation and and gave the enum-values better names), also added a more descriptive description.

Location:
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs

    r16220 r16229  
    5050    private const string LossFunctionParameterName = "LossFunction";
    5151    private const string UpdateIntervalParameterName = "UpdateInterval";
    52     private const string CreateSolutionParameterName = "CreateSolution";
     52    private const string ModelCreationParameterName = "ModelCreation";
    5353    #endregion
    5454
     
    8181      get { return (IFixedValueParameter<IntValue>)Parameters[UpdateIntervalParameterName]; }
    8282    }
    83     private IFixedValueParameter<EnumValue<ModelStorage>> CreateSolutionParameter {
    84       get { return (IFixedValueParameter<EnumValue<ModelStorage>>)Parameters[CreateSolutionParameterName]; }
     83    private IFixedValueParameter<EnumValue<ModelCreation>> ModelCreationParameter {
     84      get { return (IFixedValueParameter<EnumValue<ModelCreation>>)Parameters[ModelCreationParameterName]; }
    8585    }
    8686    #endregion
     
    115115      set { MParameter.Value.Value = value; }
    116116    }
    117     public ModelStorage CreateSolution {
    118       get { return CreateSolutionParameter.Value.Value; }
    119       set { CreateSolutionParameter.Value.Value = value; }
     117    public ModelCreation ModelCreation {
     118      get { return ModelCreationParameter.Value.Value; }
     119      set { ModelCreationParameter.Value.Value = value; }
    120120    }
    121121    #endregion
     
    154154      Parameters.Add(new FixedValueParameter<IntValue>(UpdateIntervalParameterName, "", new IntValue(100)));
    155155      Parameters[UpdateIntervalParameterName].Hidden = true;
    156       Parameters.Add(new FixedValueParameter<EnumValue<ModelStorage>>(CreateSolutionParameterName, "Flag that indicates what kind of solution should be produced at the end of the run", new EnumValue<ModelStorage>(ModelStorage.Parameter)));
    157       Parameters[CreateSolutionParameterName].Hidden = true;
     156      Parameters.Add(new FixedValueParameter<EnumValue<ModelCreation>>(ModelCreationParameterName, "Defines the results produced at the end of the run (Surrogate => Less disk space, lazy recalculation of model)", new EnumValue<ModelCreation>(ModelCreation.SurrogateModel)));
     157      Parameters[ModelCreationParameterName].Hidden = true;
    158158
    159159      var lossFunctions = ApplicationManager.Manager.GetInstances<ILossFunction>();
     
    189189      #region CreateSolution
    190190      // parameter type has been changed
    191       var createSolutionParam = Parameters[CreateSolutionParameterName] as FixedValueParameter<BoolValue>;
    192       if (createSolutionParam != null) {
    193         Parameters.Remove(CreateSolutionParameterName);
    194 
    195         ModelStorage value = createSolutionParam.Value.Value ? ModelStorage.Parameter : ModelStorage.Quality;
    196         Parameters.Add(new FixedValueParameter<EnumValue<ModelStorage>>(CreateSolutionParameterName, "Flag that indicates what kind of solution should be produced at the end of the run", new EnumValue<ModelStorage>(value)));
    197         Parameters[CreateSolutionParameterName].Hidden = true;
     191      if (Parameters.ContainsKey("CreateSolution")) {
     192        var createSolutionParam = Parameters["CreateSolution"] as FixedValueParameter<BoolValue>;
     193        if (createSolutionParam != null) {
     194          Parameters.Remove(ModelCreationParameterName);
     195
     196          ModelCreation value = createSolutionParam.Value.Value ? ModelCreation.SurrogateModel : ModelCreation.QualityOnly;
     197          Parameters.Add(new FixedValueParameter<EnumValue<ModelCreation>>(ModelCreationParameterName, "Defines the results produced at the end of the run (Surrogate => Less disk space, lazy recalculation of model)", new EnumValue<ModelCreation>(value)));
     198          Parameters[ModelCreationParameterName].Hidden = true;
     199        }
    198200      }
    199201      #endregion
     
    265267
    266268      // produce solution
    267       if (CreateSolution == ModelStorage.Parameter || CreateSolution == ModelStorage.Complete) {
     269      if (ModelCreation == ModelCreation.SurrogateModel || ModelCreation == ModelCreation.Model) {
    268270        IRegressionModel model = state.GetModel();
    269271
    270         if (CreateSolution == ModelStorage.Parameter) {
     272        if (ModelCreation == ModelCreation.SurrogateModel) {
    271273          model = new GradientBoostedTreesModelSurrogate(problemData, (uint)Seed, lossFunction, Iterations, MaxSize, R, M, Nu, (GradientBoostedTreesModel)model);
    272274        }
     
    292294          Results.Add(new Result("Solution", new GradientBoostedTreesSolution(model, problemData)));
    293295        }
    294       } else if (CreateSolution == ModelStorage.Quality) {
     296      } else if (ModelCreation == ModelCreation.QualityOnly) {
    295297        //Do nothing
    296298      } else {
Note: See TracChangeset for help on using the changeset viewer.