Changeset 16229 for branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees
- Timestamp:
- 10/11/18 10:51:52 (6 years ago)
- 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 50 50 private const string LossFunctionParameterName = "LossFunction"; 51 51 private const string UpdateIntervalParameterName = "UpdateInterval"; 52 private const string CreateSolutionParameterName = "CreateSolution";52 private const string ModelCreationParameterName = "ModelCreation"; 53 53 #endregion 54 54 … … 81 81 get { return (IFixedValueParameter<IntValue>)Parameters[UpdateIntervalParameterName]; } 82 82 } 83 private IFixedValueParameter<EnumValue<Model Storage>> CreateSolutionParameter {84 get { return (IFixedValueParameter<EnumValue<Model Storage>>)Parameters[CreateSolutionParameterName]; }83 private IFixedValueParameter<EnumValue<ModelCreation>> ModelCreationParameter { 84 get { return (IFixedValueParameter<EnumValue<ModelCreation>>)Parameters[ModelCreationParameterName]; } 85 85 } 86 86 #endregion … … 115 115 set { MParameter.Value.Value = value; } 116 116 } 117 public Model Storage 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; } 120 120 } 121 121 #endregion … … 154 154 Parameters.Add(new FixedValueParameter<IntValue>(UpdateIntervalParameterName, "", new IntValue(100))); 155 155 Parameters[UpdateIntervalParameterName].Hidden = true; 156 Parameters.Add(new FixedValueParameter<EnumValue<Model Storage>>(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; 158 158 159 159 var lossFunctions = ApplicationManager.Manager.GetInstances<ILossFunction>(); … … 189 189 #region CreateSolution 190 190 // 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 } 198 200 } 199 201 #endregion … … 265 267 266 268 // produce solution 267 if ( CreateSolution == ModelStorage.Parameter || CreateSolution == ModelStorage.Complete) {269 if (ModelCreation == ModelCreation.SurrogateModel || ModelCreation == ModelCreation.Model) { 268 270 IRegressionModel model = state.GetModel(); 269 271 270 if ( CreateSolution == ModelStorage.Parameter) {272 if (ModelCreation == ModelCreation.SurrogateModel) { 271 273 model = new GradientBoostedTreesModelSurrogate(problemData, (uint)Seed, lossFunction, Iterations, MaxSize, R, M, Nu, (GradientBoostedTreesModel)model); 272 274 } … … 292 294 Results.Add(new Result("Solution", new GradientBoostedTreesSolution(model, problemData))); 293 295 } 294 } else if ( CreateSolution == ModelStorage.Quality) {296 } else if (ModelCreation == ModelCreation.QualityOnly) { 295 297 //Do nothing 296 298 } else {
Note: See TracChangeset
for help on using the changeset viewer.