Changeset 13205 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 11/17/15 11:47:52 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessClassification.cs
r12504 r13205 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; … … 48 49 49 50 private const string ModelParameterName = "Model"; 51 private const string CreateSolutionParameterName = "CreateSolution"; 50 52 51 53 #region parameter properties … … 55 57 public IFixedValueParameter<GaussianProcessClassificationSolutionCreator> GaussianProcessSolutionCreatorParameter { 56 58 get { return (IFixedValueParameter<GaussianProcessClassificationSolutionCreator>)Parameters[SolutionCreatorParameterName]; } 59 } 60 public IFixedValueParameter<BoolValue> CreateSolutionParameter { 61 get { return (IFixedValueParameter<BoolValue>)Parameters[CreateSolutionParameterName]; } 62 } 63 #endregion 64 #region properties 65 public bool CreateSolution { 66 get { return CreateSolutionParameter.Value.Value; } 67 set { CreateSolutionParameter.Value.Value = value; } 57 68 } 58 69 #endregion … … 82 93 new GaussianProcessClassificationSolutionCreator())); 83 94 Parameters[SolutionCreatorParameterName].Hidden = true; 95 // TODO: it would be better to deactivate the solution creator when this parameter is changed 96 Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true))); 97 Parameters[CreateSolutionParameterName].Hidden = true; 84 98 85 99 ParameterizedModelCreators(); … … 91 105 [StorableHook(HookType.AfterDeserialization)] 92 106 private void AfterDeserialization() { 107 // BackwardsCompatibility3.3 108 #region Backwards compatible code, remove with 3.4 109 if (!Parameters.ContainsKey(CreateSolutionParameterName)) { 110 Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true))); 111 Parameters[CreateSolutionParameterName].Hidden = true; 112 } 113 #endregion 93 114 RegisterEventHandlers(); 94 115 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessClassificationSolutionCreator.cs
r12012 r13205 40 40 private const string TrainingAccuracyResultName = "Accuracy (training)"; 41 41 private const string TestAccuracyResultName = "Accuracy (test)"; 42 private const string CreateSolutionParameterName = "CreateSolution"; 42 43 43 44 #region Parameter Properties … … 54 55 get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; } 55 56 } 57 public ILookupParameter<BoolValue> CreateSolutionParameter { 58 get { return (ILookupParameter<BoolValue>)Parameters[CreateSolutionParameterName]; } 59 } 56 60 #endregion 57 61 … … 64 68 Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The classification problem data for the Gaussian process solution.")); 65 69 Parameters.Add(new LookupParameter<IGaussianProcessModel>(ModelParameterName, "The Gaussian process classification 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 66 72 // in & out 67 73 Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection of the algorithm.")); 68 74 // out 69 75 Parameters.Add(new LookupParameter<IDiscriminantFunctionClassificationSolution>(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 70 86 } 71 87 … … 75 91 76 92 public override IOperation Apply() { 77 if (ModelParameter.ActualValue != null ) {93 if (ModelParameter.ActualValue != null && CreateSolutionParameter.ActualValue.Value == true) { 78 94 var m = (IGaussianProcessModel)ModelParameter.ActualValue.Clone(); 79 95 m.FixParameters(); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs
r12504 r13205 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; … … 48 49 49 50 private const string ModelParameterName = "Model"; 51 private const string CreateSolutionParameterName = "CreateSolution"; 52 50 53 51 54 #region parameter properties … … 55 58 public IFixedValueParameter<GaussianProcessRegressionSolutionCreator> GaussianProcessSolutionCreatorParameter { 56 59 get { return (IFixedValueParameter<GaussianProcessRegressionSolutionCreator>)Parameters[SolutionCreatorParameterName]; } 60 } 61 public IFixedValueParameter<BoolValue> CreateSolutionParameter { 62 get { return (IFixedValueParameter<BoolValue>)Parameters[CreateSolutionParameterName]; } 63 } 64 #endregion 65 #region properties 66 public bool CreateSolution { 67 get { return CreateSolutionParameter.Value.Value; } 68 set { CreateSolutionParameter.Value.Value = value; } 57 69 } 58 70 #endregion … … 78 90 Parameters.Add(new ConstrainedValueParameter<IGaussianProcessRegressionModelCreator>(ModelCreatorParameterName, "The operator to create the Gaussian process model.", 79 91 new ItemSet<IGaussianProcessRegressionModelCreator>(modelCreators), defaultModelCreator)); 80 // th is parameter is not intended to be changed,92 // the solution creator cannot be changed 81 93 Parameters.Add(new FixedValueParameter<GaussianProcessRegressionSolutionCreator>(SolutionCreatorParameterName, "The solution creator for the algorithm", 82 94 new GaussianProcessRegressionSolutionCreator())); 83 95 Parameters[SolutionCreatorParameterName].Hidden = true; 96 // TODO: it would be better to deactivate the solution creator when this parameter is changed 97 Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true))); 98 Parameters[CreateSolutionParameterName].Hidden = true; 84 99 85 100 ParameterizedModelCreators(); … … 91 106 [StorableHook(HookType.AfterDeserialization)] 92 107 private void AfterDeserialization() { 108 // BackwardsCompatibility3.3 109 #region Backwards compatible code, remove with 3.4 110 if (!Parameters.ContainsKey(CreateSolutionParameterName)) { 111 Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true))); 112 Parameters[CreateSolutionParameterName].Hidden = true; 113 } 114 #endregion 93 115 RegisterEventHandlers(); 94 116 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolutionCreator.cs
r12012 r13205 40 40 private const string TrainingRSquaredResultName = "Training R²"; 41 41 private const string TestRSquaredResultName = "Test R²"; 42 private const string CreateSolutionParameterName = "CreateSolution"; 42 43 43 44 #region Parameter Properties … … 54 55 get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; } 55 56 } 57 public ILookupParameter<BoolValue> CreateSolutionParameter { 58 get { return (ILookupParameter<BoolValue>)Parameters[CreateSolutionParameterName]; } 59 } 56 60 #endregion 57 61 … … 64 68 Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The regression problem data for the Gaussian process solution.")); 65 69 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 66 72 // in & out 67 73 Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection of the algorithm.")); 68 74 // out 69 75 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 70 86 } 71 87 … … 75 91 76 92 public override IOperation Apply() { 77 if (ModelParameter.ActualValue != null ) {93 if (ModelParameter.ActualValue != null && CreateSolutionParameter.ActualValue.Value == true) { 78 94 var m = (IGaussianProcessModel)ModelParameter.ActualValue.Clone(); 79 95 m.FixParameters();
Note: See TracChangeset
for help on using the changeset viewer.