1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using HeuristicLab.Common;
|
---|
23 | using HeuristicLab.Core;
|
---|
24 | using HeuristicLab.Data;
|
---|
25 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
26 | using HeuristicLab.Operators;
|
---|
27 | using HeuristicLab.Parameters;
|
---|
28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
29 |
|
---|
30 | namespace HeuristicLab.Algorithms.DataAnalysis {
|
---|
31 | [StorableClass]
|
---|
32 | // base class for GaussianProcessModelCreators (specific for classification and regression)
|
---|
33 | public abstract class GaussianProcessModelCreator : SingleSuccessorOperator {
|
---|
34 | private const string HyperparameterParameterName = "Hyperparameter";
|
---|
35 | private const string MeanFunctionParameterName = "MeanFunction";
|
---|
36 | private const string CovarianceFunctionParameterName = "CovarianceFunction";
|
---|
37 | private const string ModelParameterName = "Model";
|
---|
38 | private const string NegativeLogLikelihoodParameterName = "NegativeLogLikelihood";
|
---|
39 | private const string HyperparameterGradientsParameterName = "HyperparameterGradients";
|
---|
40 |
|
---|
41 | #region Parameter Properties
|
---|
42 | // in
|
---|
43 | public ILookupParameter<RealVector> HyperparameterParameter {
|
---|
44 | get { return (ILookupParameter<RealVector>)Parameters[HyperparameterParameterName]; }
|
---|
45 | }
|
---|
46 | public ILookupParameter<IMeanFunction> MeanFunctionParameter {
|
---|
47 | get { return (ILookupParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
|
---|
48 | }
|
---|
49 | public ILookupParameter<ICovarianceFunction> CovarianceFunctionParameter {
|
---|
50 | get { return (ILookupParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
|
---|
51 | }
|
---|
52 | // out
|
---|
53 | public ILookupParameter<IGaussianProcessModel> ModelParameter {
|
---|
54 | get { return (ILookupParameter<IGaussianProcessModel>)Parameters[ModelParameterName]; }
|
---|
55 | }
|
---|
56 | public ILookupParameter<RealVector> HyperparameterGradientsParameter {
|
---|
57 | get { return (ILookupParameter<RealVector>)Parameters[HyperparameterGradientsParameterName]; }
|
---|
58 | }
|
---|
59 | public ILookupParameter<DoubleValue> NegativeLogLikelihoodParameter {
|
---|
60 | get { return (ILookupParameter<DoubleValue>)Parameters[NegativeLogLikelihoodParameterName]; }
|
---|
61 | }
|
---|
62 |
|
---|
63 | #endregion
|
---|
64 |
|
---|
65 | #region Properties
|
---|
66 | protected RealVector Hyperparameter { get { return HyperparameterParameter.ActualValue; } }
|
---|
67 | protected IMeanFunction MeanFunction { get { return MeanFunctionParameter.ActualValue; } }
|
---|
68 | protected ICovarianceFunction CovarianceFunction { get { return CovarianceFunctionParameter.ActualValue; } }
|
---|
69 | #endregion
|
---|
70 |
|
---|
71 | [StorableConstructor]
|
---|
72 | protected GaussianProcessModelCreator(bool deserializing) : base(deserializing) { }
|
---|
73 | protected GaussianProcessModelCreator(GaussianProcessModelCreator original, Cloner cloner) : base(original, cloner) { }
|
---|
74 | protected GaussianProcessModelCreator()
|
---|
75 | : base() {
|
---|
76 | // in
|
---|
77 | Parameters.Add(new LookupParameter<RealVector>(HyperparameterParameterName, "The hyperparameters for the Gaussian process model."));
|
---|
78 | Parameters.Add(new LookupParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function for the Gaussian process model."));
|
---|
79 | Parameters.Add(new LookupParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function for the Gaussian process model."));
|
---|
80 | // out
|
---|
81 | Parameters.Add(new LookupParameter<IGaussianProcessModel>(ModelParameterName, "The resulting Gaussian process model"));
|
---|
82 | Parameters.Add(new LookupParameter<RealVector>(HyperparameterGradientsParameterName, "The gradients of the hyperparameters for the produced Gaussian process model (necessary for hyperparameter optimization)"));
|
---|
83 | Parameters.Add(new LookupParameter<DoubleValue>(NegativeLogLikelihoodParameterName, "The negative log-likelihood of the produced Gaussian process model given the data."));
|
---|
84 | }
|
---|
85 | }
|
---|
86 | }
|
---|