25 #include "posterior_empirical.hpp" 31 EmpiricalBayes::EmpiricalBayes(
size_t dim,
Parameters parameters,
36 setSurrogateModel(eng);
40 size_t nhp =
mGP->nHyperParameters();
47 kOptimizer->setAlgorithm(
BOBYQA);
48 kOptimizer->setMaxEvals(10*nhp);
53 kOptimizer->setMaxEvals(20*nhp);
56 kOptimizer->setLimits(svectord(nhp,-6.0),svectord(nhp,1.0));
63 void EmpiricalBayes::updateHyperParameters()
65 FILE_LOG(logDEBUG) <<
"------ Optimizing hyperparameters ------";
66 vectord optimalTheta =
mGP->getHyperParameters();
68 FILE_LOG(logDEBUG) <<
"Initial hyper parameters: " << optimalTheta;
69 kOptimizer->run(optimalTheta);
70 mGP->setHyperParameters(optimalTheta);
71 FILE_LOG(logDEBUG) <<
"Final hyper parameters: " << optimalTheta;
75 void EmpiricalBayes::setSurrogateModel(randEngine& eng)
81 void EmpiricalBayes::setCriteria(randEngine& eng)
86 mCrit->setRandomEngine(eng);
96 FILE_LOG(logERROR) <<
"Expected " <<
mCrit->nParameters()
97 <<
" parameters. Got " 100 FILE_LOG(logINFO) <<
"Using default parameters for criteria.";
virtual ~EmpiricalBayes()
Default destructor.
Factory model for criterion functions This factory is based on the libgp library by Manuel Blum https...
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.
Parameters mParameters
Configuration parameters.
vectord crit_params
Criterion hyperparameters (if needed)
Criteria * create(std::string name, NonParametricProcess *proc)
Factory model for criterion functions This function is based on the libgp library by Manuel Blum http...
size_t mDims
Number of dimensions.
Global exploration, local refinement (hand tuned)
boost::scoped_ptr< NonParametricProcess > mGP
Pointer to surrogate model.
std::string crit_name
Name of the criterion.
C++ wrapper of the NLOPT library.
boost::scoped_ptr< Criteria > mCrit
Metacriteria model.
Modules and helper macros for logging.
score_type sc_type
Score type for kernel hyperparameters (ML,MAP,etc)
Dataset mData
Dataset (x-> inputs, y-> labels/output)
Bayesian optimization using different non-parametric processes as distributions over surrogate functi...