24 #ifndef _KERNEL_ATOMIC_HPP_ 25 #define _KERNEL_ATOMIC_HPP_ 42 virtual void init(
size_t input_dim)
43 { n_inputs = input_dim; };
45 void setHyperParameters(
const vectord &theta)
47 if(theta.size() != n_params)
49 throw std::invalid_argument(
"Wrong number of kernel hyperparameters");
52 std::transform(theta.begin(), theta.end(), params.begin(), (double (*)(double)) exp);
55 vectord getHyperParameters()
57 vectord theta(params.size());
58 std::transform(params.begin(), params.end(), theta.begin(), (double (*)(double)) log);
61 size_t nHyperParameters() {
return n_params;};
79 inline double computeWeightedNorm2(
const vectord &x1,
const vectord &x2)
81 assert(n_inputs == x1.size());
82 assert(x1.size() == x2.size());
83 return norm_2(x1-x2)/params(0);
96 inline double computeWeightedNorm2(
const vectord &x1,
const vectord &x2)
98 assert(n_inputs == x1.size());
99 assert(x1.size() == x2.size());
100 assert(x1.size() == params.size());
Kernel (covariance) functions.
Abstract class for isotropic kernel functors.
Namespace of the library interface.
Elementwise operations for ublas vector/matrix.
Abstract class for anisotropic kernel functors using ARD (Automatic Relevance Determination) ...
Interface for kernel functors.
v1 ublas_elementwise_div(const v1 &a, const v2 &b)
Computes the elementwise division of two vectors or matrices.
Abstract class for an atomic kernel.