Commit 245c85db authored by Konstantinos Chatzilygeroudis's avatar Konstantinos Chatzilygeroudis Committed by GitHub
Browse files

Merge pull request #150 from resibots/typos_fix

Fix typos in matern kernels
parents 4f6cacae 73f6c2b7
......@@ -17,7 +17,7 @@ struct Params {
};
#endif
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.2);
};
......
#include <limbo/tools/macros.hpp>
#include <limbo/kernel/matern_five_halfs.hpp>
#include <limbo/kernel/matern_five_halves.hpp>
#include <limbo/mean/data.hpp>
#include <limbo/model/gp.hpp>
#include <limbo/acqui/gp_ucb.hpp>
......@@ -27,7 +27,7 @@ BO_PARAMS(std::cout,
BO_PARAM(double, alpha, 0.1);
};
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.2);
};
......
#include <limbo/tools/macros.hpp>
#include <limbo/kernel/matern_five_halfs.hpp>
#include <limbo/kernel/matern_five_halves.hpp>
#include <limbo/mean/data.hpp>
#include <limbo/model/gp.hpp>
#include <limbo/acqui/gp_ucb.hpp>
......@@ -21,7 +21,7 @@ struct Params {
struct opt_gridsearch : public defaults::opt_gridsearch {
};
#endif
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.2);
};
......
......@@ -24,7 +24,7 @@ struct Params {
struct kernel_squared_exp_ard : public defaults::kernel_squared_exp_ard {
};
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.2);
};
......
......@@ -5,8 +5,8 @@
///@defgroup kernel_defaults
#include <limbo/kernel/exp.hpp>
#include <limbo/kernel/matern_five_halfs.hpp>
#include <limbo/kernel/matern_three_halfs.hpp>
#include <limbo/kernel/matern_five_halves.hpp>
#include <limbo/kernel/matern_three_halves.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#endif
......@@ -20,7 +20,7 @@ namespace limbo {
Exponential kernel (see :cite:`brochu2010tutorial` p. 9).
.. math::
k(v_1, v_2) = \sigma^2\exp \Big(-\frac{1}{\l^2} ||v_1 - v_2||^2\Big)
k(v_1, v_2) = \sigma^2\exp \Big(-\frac{1}{l^2} ||v_1 - v_2||^2\Big)
Parameters:
- ``double sigma_sq`` (signal variance)
......
#ifndef LIMBO_KERNEL_MATERN_FIVE_HALFS_HPP
#define LIMBO_KERNEL_MATERN_FIVE_HALFS_HPP
#ifndef LIMBO_KERNEL_MATERN_FIVE_HALVES_HPP
#define LIMBO_KERNEL_MATERN_FIVE_HALVES_HPP
#include <Eigen/Core>
......@@ -7,7 +7,7 @@
namespace limbo {
namespace defaults {
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
/// @ingroup kernel_defaults
BO_PARAM(double, sigma_sq, 1);
/// @ingroup kernel_defaults
......@@ -44,7 +44,7 @@ namespace limbo {
double operator()(const Eigen::VectorXd& v1, const Eigen::VectorXd& v2) const
{
double d = (v1 - v2).norm();
return Params::kernel_maternfivehalfs::sigma_sq() * (1 + std::sqrt(5) * d / Params::kernel_maternfivehalfs::l() + 5 * d * d / (3 * Params::kernel_maternfivehalfs::l() * Params::kernel_maternfivehalfs::l())) * std::exp(-std::sqrt(5) * d / Params::kernel_maternfivehalfs::l());
return Params::kernel_maternfivehalves::sigma_sq() * (1 + std::sqrt(5) * d / Params::kernel_maternfivehalves::l() + 5 * d * d / (3 * Params::kernel_maternfivehalves::l() * Params::kernel_maternfivehalves::l())) * std::exp(-std::sqrt(5) * d / Params::kernel_maternfivehalves::l());
}
};
}
......
#ifndef LIMBO_KERNEL_MATERN_THREE_HALFS_HPP
#define LIMBO_KERNEL_MATERN_THREE_HALFS_HPP
#ifndef LIMBO_KERNEL_MATERN_THREE_HALVES_HPP
#define LIMBO_KERNEL_MATERN_THREE_HALVES_HPP
#include <Eigen/Core>
......@@ -7,9 +7,8 @@
namespace limbo {
namespace defaults {
struct kernel_maternthreehalfs {
struct kernel_maternthreehalves {
/// @ingroup kernel_defaults
/// This is is sigma squared!
BO_PARAM(double, sigma_sq, 1);
/// @ingroup kernel_defaults
BO_PARAM(double, l, 1);
......@@ -43,7 +42,7 @@ namespace limbo {
double operator()(const Eigen::VectorXd& v1, const Eigen::VectorXd& v2) const
{
double d = (v1 - v2).norm();
return Params::kernel_maternthreehalfs::sigma_sq() * (1 + std::sqrt(3) * d / Params::kernel_maternthreehalfs::l()) * std::exp(-std::sqrt(3) * d / Params::kernel_maternthreehalfs::l());
return Params::kernel_maternthreehalves::sigma_sq() * (1 + std::sqrt(3) * d / Params::kernel_maternthreehalves::l()) * std::exp(-std::sqrt(3) * d / Params::kernel_maternthreehalves::l());
}
};
}
......
......@@ -6,7 +6,9 @@
namespace limbo {
namespace defaults {
struct kernel_squared_exp_ard {
/// @ingroup kernel_defaults
BO_PARAM(int, k, 0); //equivalent to the standard exp ARD
/// @ingroup kernel_defaults
BO_PARAM(double, sigma_sq, 1);
};
}
......@@ -20,9 +22,13 @@ namespace limbo {
Computes the squared exponential covariance like this:
.. math::
k_{SE}(x, y) = \alpha^2 \exp \Big(-\frac{1}{2}(x-y)^TM(x-y)\Big),
k_{SE}(x, y) = \sigma^2 \exp \Big(-\frac{1}{2}(x-y)^TM(x-y)\Big),
with :math:`M = \Lambda\Lambda^T + diag(l_1^{-2}, \dots, l_n^{-2})` being the characteristic length scales and :math:`\alpha` describing the variability of the latent function. The parameters :math:`l_1^2, \dots, l_n^2, \alpha, \Lambda` are expected in this order in the parameter array.
with :math:`M = \Lambda\Lambda^T + diag(l_1^{-2}, \dots, l_n^{-2})` being the characteristic length scales and :math:`\alpha` describing the variability of the latent function. The parameters :math:`l_1^2, \dots, l_n^2, \Lambda` are expected in this order in the parameter array. :math:`\Lambda` is a :math:`D\times k` matrix with :math:`k<D`.
Parameters:
- ``double sigma_sq`` (signal variance)
- ``int k`` (number of columns of :math:`\Lambda` matrix)
Reference: :cite:`Rasmussen2006`, p. 106 & :cite:`brochu2010tutorial`, p. 10
\endrst
......
......@@ -13,12 +13,12 @@ struct Params {
BO_PARAM(double, l, 1);
};
struct kernel_maternthreehalfs {
struct kernel_maternthreehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.2);
};
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.2);
};
......
......@@ -4,8 +4,8 @@
#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>
#include <limbo/kernel/matern_five_halves.hpp>
#include <limbo/kernel/matern_three_halves.hpp>
#include <limbo/kernel/exp.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#include <limbo/mean/constant.hpp>
......@@ -32,7 +32,7 @@ struct Params {
struct kernel_squared_exp_ard : public defaults::kernel_squared_exp_ard {
};
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 1);
BO_PARAM(double, l, 0.25);
};
......@@ -290,11 +290,11 @@ BOOST_AUTO_TEST_CASE(test_gp_init_variance)
BO_PARAM(double, sigma_sq, 10);
BO_PARAM(double, l, 1);
};
struct kernel_maternthreehalfs {
struct kernel_maternthreehalves {
BO_PARAM(double, sigma_sq, 10);
BO_PARAM(double, l, 0.25);
};
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma_sq, 10);
BO_PARAM(double, l, 0.25);
};
......
......@@ -26,7 +26,7 @@ struct Params {
struct kernel_exp : public defaults::kernel_exp {
};
struct kernel_maternfivehalfs {
struct kernel_maternfivehalves {
BO_PARAM(double, sigma, 1);
BO_PARAM(double, l, 0.25);
};
......
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