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

Merge remote-tracking branch 'origin/gp_multi' into remove_boost_shared_ptr

Conflicts:
	src/limbo/bayes_opt/boptimizer.hpp
parents ed4fa763 71c9278f
......@@ -20,6 +20,7 @@
#include <limbo/stop/max_iterations.hpp>
#include <limbo/stat/samples.hpp>
#include <limbo/stat/aggregated_observations.hpp>
#include <limbo/stat/console_summary.hpp>
#include <limbo/tools/sys.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#include <limbo/acqui/gp_ucb.hpp>
......@@ -32,7 +33,7 @@
namespace limbo {
namespace defaults {
struct bayes_opt_bobase {
BO_PARAM(bool, stats_enabled, true);
BO_PARAM(bool, stats_enabled, true);
};
}
template <typename BO, typename AggregatorFunction>
......@@ -108,7 +109,7 @@ namespace limbo {
// WARNING: you have to specify the acquisition function
// if you use a custom model
typedef acqui::GP_UCB<Params, model_t> acqui_t; // 4
typedef boost::fusion::vector<stat::Samples<Params>, stat::AggregatedObservations<Params>> stat_t; // 5
typedef boost::fusion::vector<stat::Samples<Params>, stat::AggregatedObservations<Params>, stat::ConsoleSummary<Params>> stat_t; // 5
typedef boost::fusion::vector<stop::MaxIterations<Params>> stop_t; // 6
};
......@@ -165,7 +166,7 @@ namespace limbo {
this->_total_iterations = 0;
this->_samples.clear();
this->_observations.clear();
this->_bl_samples.clear();
this->_bl_samples.clear();
}
if (this->_total_iterations == 0)
......
......@@ -85,24 +85,6 @@ namespace limbo {
this->_update_stats(*this, afun, blacklisted);
std::cout << this->_current_iteration << " new point: "
<< (blacklisted ? this->_bl_samples.back()
: this->_samples.back()).transpose();
if (blacklisted)
std::cout << " value: "
<< "No data, blacklisted";
else
std::cout << " value: " << afun(this->_observations.back());
// std::cout << " mu: "<< _model.mu(blacklisted ? this->_bl_samples.back()
// : this->_samples.back()).transpose()
//<< " mean: " << _model.mean_function()(new_sample, _model).transpose()
//<< " sigma: "<< _model.sigma(blacklisted ? this->_bl_samples.back() :
//this->_samples.back())
//<< " acqui: "<< acqui(blacklisted ? this->_bl_samples.back() :
//this->_samples.back(), afun)
std::cout << " best:" << afun(this->best_observation(afun)) << std::endl;
if (!this->_observations.empty())
_model.compute(this->_samples, this->_observations, Params::bayes_opt_boptimizer::noise(), this->_bl_samples);
......
......@@ -5,6 +5,7 @@
#include <limbo/stat/best_observations.hpp>
#include <limbo/stat/best_samples.hpp>
#include <limbo/stat/bl_samples.hpp>
#include <limbo/stat/console_summary.hpp>
#include <limbo/stat/aggregated_observations.hpp>
#include <limbo/stat/observations.hpp>
#include <limbo/stat/gp_acquisitions.hpp>
......
#ifndef LIMBO_STAT_CONSOLE_SUMMARY_HPP
#define LIMBO_STAT_CONSOLE_SUMMARY_HPP
#include <limbo/stat/stat_base.hpp>
namespace limbo {
namespace stat {
template <typename Params>
struct ConsoleSummary : public StatBase<Params> {
template <typename BO, typename AggregatorFunction>
void operator()(const BO& bo, const AggregatorFunction& afun, bool blacklisted)
{
if (!bo.stats_enabled() || bo.observations().empty())
return;
std::cout << bo.total_iterations() << " new point: "
<< (blacklisted ? bo.bl_samples().back()
: bo.samples().back()).transpose();
if (blacklisted)
std::cout << " value: "
<< "No data, blacklisted";
else
std::cout << " value: " << afun(bo.observations().back());
std::cout << " best:" << afun(bo.best_observation(afun)) << std::endl;
}
};
}
}
#endif
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