Commit 7d74e698 authored by Federico Allocati's avatar Federico Allocati
Browse files

Added Aggregated Observations stat, and set it as default for bo_base

parent 4b0dca61
......@@ -18,6 +18,7 @@
#include <limbo/stop/chain_criteria.hpp>
#include <limbo/stop/max_iterations.hpp>
#include <limbo/stat/samples.hpp>
#include <limbo/stat/aggregated_observations.hpp>
#include <limbo/tools/sys.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#include <limbo/acqui/gp_ucb.hpp>
......@@ -102,7 +103,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 stat::Samples<Params> stat_t; // 5
typedef boost::fusion::vector<stat::Samples<Params>, stat::AggregatedObservations<Params>> stat_t; // 5
typedef boost::fusion::vector<stop::MaxIterations<Params>> stop_t; // 6
};
......
#ifndef LIMBO_STAT_AGGREGATED_OBSERVATIONS_HPP
#define LIMBO_STAT_AGGREGATED_OBSERVATIONS_HPP
#include <limbo/stat/stat_base.hpp>
namespace limbo {
namespace stat {
template <typename Params>
struct AggregatedObservations : 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;
this->_create_log_file(bo, "aggregated_observations.dat");
if (bo.total_iterations() == 0) {
std::cout << "#iteration aggregated_observation" << std::endl;
for (size_t i = 0; i < bo.observations().size() -1; i++)
(*this->_log_file) << "-1 " << afun(bo.observations()[i]) << std::endl;
}
if (!blacklisted)
(*this->_log_file) << bo.total_iterations() << " " << afun(bo.observations().back()) << 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