Commit 3dc01c47 authored by Federico Allocati's avatar Federico Allocati
Browse files

Ability to select which optimizer to use for GP likelihood optimization

parent 371a5147
......@@ -153,10 +153,10 @@ int main()
typedef kernel::SquaredExpARD<Params> Kernel_t;
typedef mean::FunctionARD<Params, MeanComplet<Params>> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t> GP_t;
typedef model::GP<Params, Kernel_t, Mean_t, model::gp::KernelMeanLFOpt<Params>> GP_t;
typedef UCB_multi<Params, GP_t> Acqui_t;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>, model::gp::KernelMeanLFOpt<Params>> opt;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;
opt.optimize(fit_eval());
std::cout << opt.best_observation() << " res "
......
......@@ -9,15 +9,15 @@
namespace limbo {
namespace model {
namespace gp {
template <typename Params>
template <typename Params, typename Optimizer = opt::ParallelRepeater<Params, opt::Rprop<Params>>>
struct KernelLFOpt {
public:
template <typename GP>
void operator()(GP& gp) const
{
KernelLFOptimization<GP> optimization(gp);
opt::ParallelRepeater<Params, opt::Rprop<Params>> par_rprop;
auto params = par_rprop(optimization);
Optimizer optimizer;
auto params = optimizer(optimization);
gp.kernel_function().set_h_params(params);
gp.set_lik(optimization.utility(params));
gp.update();
......
......@@ -9,15 +9,15 @@
namespace limbo {
namespace model {
namespace gp {
template <typename Params>
template <typename Params, typename Optimizer = opt::ParallelRepeater<Params, opt::Rprop<Params>>>
struct KernelMeanLFOpt {
public:
template <typename GP>
void operator()(GP& gp) const
{
KernelMeanLFOptimization<GP> optimization(gp);
opt::ParallelRepeater<Params, opt::Rprop<Params>> par_rprop;
auto params = par_rprop(optimization);
Optimizer optimizer;
auto params = optimizer(optimization);
gp.kernel_function().set_h_params(params.head(gp.kernel_function().h_params_size()));
gp.mean_function().set_h_params(params.tail(gp.mean_function().h_params_size()));
gp.set_lik(optimization.utility(params));
......
......@@ -9,15 +9,15 @@
namespace limbo {
namespace model {
namespace gp {
template <typename Params>
template <typename Params, typename Optimizer = opt::ParallelRepeater<Params, opt::Rprop<Params>>>
struct MeanLFOpt {
public:
template <typename GP>
void operator()(GP& gp) const
{
MeanLFOptimization<GP> optimization(gp);
opt::ParallelRepeater<Params, opt::Rprop<Params>> par_rprop;
auto params = par_rprop(optimization);
Optimizer optimizer;
auto params = optimizer(optimization);
gp.mean_function().set_h_params(params);
gp.set_lik(optimization.utility(params));
gp.update();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment