Commit 276e422f authored by Antoine Cully's avatar Antoine Cully
Browse files

tests compile

parent 460c08ca
......@@ -32,13 +32,13 @@ namespace limbo {
SquaredExpARD(int dim = 1) : _sf2(0), _ell(dim), _A(dim, Params::kernel_squared_exp_ard::k()), _input_dim(dim)
{
//assert(Params::SquaredExpARD::k()<dim);
Eigen::VectorXd p = Eigen::VectorXd::Zero(_ell.size() + _ell.size() * Params::kernel_squared_exp_ard::k() + 1);
Eigen::VectorXd p = Eigen::VectorXd::Zero(_ell.size() + _ell.size() * Params::kernel_squared_exp_ard::k());
p.head(_ell.size()) = Eigen::VectorXd::Ones(_ell.size()) * -1;
this->set_h_params(p);
_sf2 = Params::kernel_squared_exp_ard::sigma_sq();
}
size_t h_params_size() const { return _ell.size() + _ell.size() * Params::kernel_squared_exp_ard::k() + 1; }
size_t h_params_size() const { return _ell.size() + _ell.size() * Params::kernel_squared_exp_ard::k(); }
const Eigen::VectorXd& h_params() const { return _h_params; }
......@@ -67,15 +67,15 @@ namespace limbo {
for (size_t j = 0; j < Params::kernel_squared_exp_ard::k(); ++j)
grad.segment((1 + j) * _input_dim, _input_dim) = G.col(j);
grad(this->h_params_size() - 1) = 0; // 2.0 * k;
//grad(this->h_params_size() - 1) = 0; // 2.0 * k;
return grad;
}
else {
Eigen::VectorXd grad(_input_dim + 1);
Eigen::VectorXd grad(_input_dim);
Eigen::VectorXd z = (x1 - x2).cwiseQuotient(_ell).array().square();
double k = _sf2 * std::exp(-0.5 * z.sum());
grad.head(_input_dim) = z * k;
grad(_input_dim) = 0; // 2.0 * k;
//grad(_input_dim) = 0; // 2.0 * k;
return grad;
}
}
......
......@@ -3,6 +3,7 @@
#include <boost/test/unit_test.hpp>
#include <limbo/acqui/ucb.hpp>
#include <limbo/kernel/matern_five_halfs.hpp>
#include <limbo/kernel/matern_three_halfs.hpp>
......
......@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(test_kernel_SE_ARD)
Eigen::VectorXd hp(se.h_params_size());
hp(0) = 0; //exp(0)=1
hp(1) = 0;
hp(2) = 1;
se.set_h_params(hp);
Eigen::VectorXd v1 = make_v2(1, 1);
......@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(test_kernel_SE_ARD)
hp(1) = 0;
hp(2) = 0;
hp(3) = 0;
hp(4) = 1;
se.set_h_params(hp);
BOOST_CHECK(s1 == se(v1, v2));
......
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