BayesOpt
nonparametricprocess.cpp
1 /*
2 -------------------------------------------------------------------------
3  This file is part of BayesOpt, an efficient C++ library for
4  Bayesian optimization.
5 
6  Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
7 
8  BayesOpt is free software: you can redistribute it and/or modify it
9  under the terms of the GNU Affero General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  BayesOpt is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Affero General Public License for more details.
17 
18  You should have received a copy of the GNU Affero General Public License
19  along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
20 ------------------------------------------------------------------------
21 */
22 
23 #include <stdexcept>
24 
25 #include "log.hpp"
26 
27 #include "gaussian_process.hpp"
28 #include "gaussian_process_ml.hpp"
32 
33 #include "nonparametricprocess.hpp"
34 
35 
36 namespace bayesopt
37 {
38 
39  NonParametricProcess::NonParametricProcess(size_t dim, Parameters parameters,
40  const Dataset& data,
41  MeanModel& mean,
42  randEngine& eng):
43  mData(data), dim_(dim), mMean(mean), mSigma(parameters.sigma_s)
44  {}
45 
46  NonParametricProcess::~NonParametricProcess(){}
47 
48 
50  Parameters parameters,
51  const Dataset& data,
52  MeanModel& mean,
53  randEngine& eng)
54  {
55  NonParametricProcess* s_ptr;
56 
57  std::string name = parameters.surr_name;
58 
59  if (!name.compare("sGaussianProcess"))
60  s_ptr = new GaussianProcess(dim,parameters,data,mean,eng);
61  else if(!name.compare("sGaussianProcessML"))
62  s_ptr = new GaussianProcessML(dim,parameters,data,mean,eng);
63  else if(!name.compare("sGaussianProcessNormal"))
64  s_ptr = new GaussianProcessNormal(dim,parameters,data,mean,eng);
65  else if (!name.compare("sStudentTProcessJef"))
66  s_ptr = new StudentTProcessJeffreys(dim,parameters,data,mean,eng);
67  else if (!name.compare("sStudentTProcessNIG"))
68  s_ptr = new StudentTProcessNIG(dim,parameters,data,mean,eng);
69  else
70  {
71  throw std::invalid_argument("Surrogate function not supported");
72  }
73  return s_ptr;
74  };
75 
76 } //namespace bayesopt
Gaussian process with ML parameters.
static NonParametricProcess * create(size_t dim, Parameters parameters, const Dataset &data, MeanModel &mean, randEngine &eng)
Factory model generator for surrogate models.
Namespace of the library interface.
Definition: using.dox:1
Student&#39;s t process with Normal-Inverse-Gamma hyperprior on mean and signal variance parameters...
Abstract class to implement Bayesian regressors.
Student T process with Jeffreys priors.
Standard zero mean gaussian process with noisy observations.
Gaussian process with normal prior on the parameters.
Student T process with Jeffreys prior.
Gaussian process with ML parameters.
Dataset model to deal with the vector (real) based datasets.
Definition: dataset.hpp:40
std::string surr_name
Name of the surrogate function.
Definition: parameters.hpp:85
Abstract module for a Bayesian regressor.
Student&#39;s t process with Normal Inverse-Gamma hyperprior on mean and snigal variance parameters...
Standard zero mean gaussian process with noisy observations.
Modules and helper macros for logging.
Gaussian process with normal prior on the parameters.