36#ifndef STK_KERNEL_GAUSSIAN_H
37#define STK_KERNEL_GAUSSIAN_H
58 typedef typename Array::Type
Type;
88 template<
class Derived>
96 template<
class Derived>
98 :
Base(data),
width_(param.empty() ? 1. : param.front())
110 template<
class Derived>
112 {
width_ = (param.empty() ? 1. : param.front());}
138{
return hasRun_ ? gram_(
i,
j)
139 : std::exp(-(p_data_->row(
i) - p_data_->row(
j)).norm2()/(2.*width_));
144{
return std::exp(-
v*
v/(2.*width_));}
In this file we define the Interface base class for computing a Kernels.
bool hasRun_
true if run has been used, false otherwise
The Gaussian Kernel is a kernel of the form.
Gaussian(Array const &data, Real const &width=1.)
constructor with a constant pointer on the data set
virtual Real diag(int i) const
virtual method.
Gaussian(Array const &data, ExprBase< Derived > const ¶m)
constructor with a constant pointer on the data set
virtual ~Gaussian()
destructor
void setWidth(Real const &width)
set the bandwidth of the kernel
Real const & width() const
IKernelBase< Array > Base
void setParam(ExprBase< Derived > const ¶m)
Set parameter using an array.
virtual Real value(Type const &v) const
compute the value of the kernel for the given value
Gaussian(Real const &width=1.)
Default constructor with the width.
Gaussian(Array const *p_data, Real const &width=1.)
constructor with a constant pointer on the data set
virtual Real comp(int i, int j) const
virtual method implementation.
Gaussian(Array const *p_data, ExprBase< Derived > const ¶m)
constructor with an array of parameter.
Real width_
bandwidth of the kernel
Interface Base class for the kernels classes.
Array const * p_data_
pointer on the data set
CSquareX gram_
the resulting gram_ matrix
Array const * p_data() const
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
double Real
STK fundamental type of Real values.
The namespace STK is the main domain space of the Statistical ToolKit project.