Commit f18adc1d authored by Konstantinos Chatzilygeroudis's avatar Konstantinos Chatzilygeroudis
Browse files

Limits to all HP Opts

parent 3006db18
......@@ -36,6 +36,7 @@ struct Params {
struct bayes_opt_boptimizer : public defaults::bayes_opt_boptimizer {
BO_PARAM(double, noise, 0.001);
BO_PARAM(bool, stats_enabled, true);
BO_PARAM(int, hp_period, 50);
};
struct init_randomsampling {
......
......@@ -21,9 +21,12 @@ namespace limbo {
KernelMeanLFOptimization<GP> optimization(gp);
Optimizer optimizer;
int dim = gp.kernel_function().h_params_size() + gp.mean_function().h_params_size();
auto params = optimizer(optimization, tools::random_vector(dim), false);
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()));
Eigen::VectorXd init(dim);
init.head(gp.kernel_function().h_params_size()) = (gp.kernel_function().h_params().array() + 6.0) / 7.0;
init.tail(gp.mean_function().h_params_size()) = (gp.mean_function().h_params().array() + 6.0) / 7.0;
auto params = optimizer(optimization, init, true);
gp.kernel_function().set_h_params(-6.0 + params.head(gp.kernel_function().h_params_size()).array() * 7.0);
gp.mean_function().set_h_params(-6.0 + params.tail(gp.mean_function().h_params_size()).array() * 7.0);
gp.set_lik(opt::eval(optimization, params));
gp.recompute(true);
}
......@@ -37,8 +40,8 @@ namespace limbo {
opt::eval_t operator()(const Eigen::VectorXd& params, bool compute_grad) const
{
GP gp(this->_original_gp);
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.kernel_function().set_h_params(-6.0 + params.head(gp.kernel_function().h_params_size()).array() * 7.0);
gp.mean_function().set_h_params(-6.0 + params.tail(gp.mean_function().h_params_size()).array() * 7.0);
gp.recompute(true);
......
......@@ -20,9 +20,8 @@ namespace limbo {
{
MeanLFOptimization<GP> optimization(gp);
Optimizer optimizer;
int dim = gp.mean_function().h_params_size();
auto params = optimizer(optimization, tools::random_vector(dim), false);
gp.mean_function().set_h_params(params);
auto params = optimizer(optimization, (gp.mean_function().h_params().array() + 6.0) / 7.0, true);
gp.mean_function().set_h_params(-6.0 + params.array() * 7.0);
gp.set_lik(opt::eval(optimization, params));
gp.recompute(true);
}
......@@ -36,7 +35,7 @@ namespace limbo {
opt::eval_t operator()(const Eigen::VectorXd& params, bool compute_grad) const
{
GP gp(this->_original_gp);
gp.mean_function().set_h_params(params);
gp.mean_function().set_h_params(-6.0 + params.array() * 7.0);
gp.recompute(true);
......
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