Commit b01537be authored by Federico Allocati's avatar Federico Allocati
Browse files

Added Prediction Differences Stat

parent cefb05e2
......@@ -7,6 +7,7 @@
#include <limbo/stat/bl_samples.hpp>
#include <limbo/stat/aggregated_observations.hpp>
#include <limbo/stat/observations.hpp>
#include <limbo/stat/gp_prediction_differences.hpp>
#include <limbo/stat/samples.hpp>
#endif
#ifndef LIMBO_STAT_GP_PREDICTION_DIFFERENCES_HPP
#define LIMBO_STAT_GP_PREDICTION_DIFFERENCES_HPP
#include <cmath>
#include <limbo/stat/stat_base.hpp>
namespace limbo {
namespace stat {
template <typename Params>
struct GPPredictionDifferences : 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() || blacklisted)
return;
this->_create_log_file(bo, "prediction_differences.dat");
if (bo.total_iterations() == 0)
std::cout << "#iteration predicted observed difference" << std::endl;
double pred = afun(bo.model().mu(bo.samples().back()));
double obs = afun(bo.observations().back());
(*this->_log_file) << bo.total_iterations() << " " << pred << " " << obs << " " << fabs(pred - obs) << std::endl;
}
};
}
}
#endif
......@@ -25,7 +25,7 @@ def create(bld):
acquisitions = ['UCB', 'GP_UCB']
optimizers = ['RandomPoint', 'GridSearch', 'Cmaes']
inits = ['NoInit', 'RandomSampling', 'RandomSamplingGrid', 'GridSampling']
stats = ['Samples', 'Observations', 'AggregatedObservations', 'BestSamples', 'BestObservations', 'BestAggregatedObservations', 'BlSamples']
stats = ['Samples', 'Observations', 'AggregatedObservations', 'BestSamples', 'BestObservations', 'BestAggregatedObservations', 'BlSamples', 'GPPredictionDifferences']
stops = ['MaxIterations', 'MaxPredictedValue']
stats = 'typedef boost::fusion::vector<' + ', '.join(['stat::' + stat + '<Params>' for stat in stats]) + '> stats_t;\n'
......
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