Commit 4aed77a2 authored by Federico Allocati's avatar Federico Allocati
Browse files

Added Stat GP Likelihood (and changed likelihood to a double)

parent 13476ec5
......@@ -133,9 +133,9 @@ namespace limbo {
this->_compute_kernel();
}
float get_lik() const { return _lik; }
double get_lik() const { return _lik; }
void set_lik(const float& lik) { _lik = lik; }
void set_lik(const double& lik) { _lik = lik; }
const Eigen::LLT<Eigen::MatrixXd>& llt() const { return _llt; }
......@@ -166,7 +166,7 @@ namespace limbo {
Eigen::LLT<Eigen::MatrixXd> _llt;
Eigen::MatrixXd _inv_bl_kernel;
float _lik;
double _lik;
void _compute_obs_mean()
{
......
......@@ -8,6 +8,7 @@
#include <limbo/stat/aggregated_observations.hpp>
#include <limbo/stat/observations.hpp>
#include <limbo/stat/gp_acquisitions.hpp>
#include <limbo/stat/gp_likelihood.hpp>
#include <limbo/stat/gp_prediction_differences.hpp>
#include <limbo/stat/samples.hpp>
......
#ifndef LIMBO_STAT_GP_LIKELIHOOD_HPP
#define LIMBO_STAT_GP_LIKELIHOOD_HPP
#include <cmath>
#include <limbo/stat/stat_base.hpp>
namespace limbo {
namespace stat {
template <typename Params>
struct GPLikelihood : 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, "gp_likelihood.dat");
if (bo.total_iterations() == 0)
std::cout << "#iteration gp_likelihood" << std::endl;
(*this->_log_file) << bo.total_iterations() << " " << bo.model().get_lik() << std::endl;
}
};
}
}
#endif
......@@ -26,7 +26,7 @@ def create(bld):
optimizers = ['RandomPoint', 'GridSearch', 'Cmaes']
inits = ['NoInit', 'RandomSampling', 'RandomSamplingGrid', 'GridSampling']
stats = ['Samples', 'Observations', 'AggregatedObservations', 'BestSamples', 'BestObservations', 'BestAggregatedObservations',
'BlSamples', 'GPPredictionDifferences', 'GPAcquisitions']
'BlSamples', 'GPPredictionDifferences', 'GPAcquisitions', 'GPLikelihood']
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