36#ifndef STK_KERNEL_LAPLACE_H
37#define STK_KERNEL_LAPLACE_H
58 typedef typename Array::Type
Type;
85 template<
class Derived>
93 template<
class Derived>
95 :
Base(data),
width_(param.empty() ? 1. : param.front())
108 template<
class Derived>
110 {
width_ = (param.empty() ? 1. : param.front());}
136 return hasRun_ ? gram_(
i,
j)
137 : std::exp(-(p_data_->row(
i) - p_data_->row(
j)).norm()/width_);
142{
return std::exp(-std::abs(
v)/width_);}
156 typedef typename Array::Type
Type;
183 template<
class Derived>
191 template<
class Derived>
193 :
Base(data),
width_(param.empty() ? 1. : param.front())
206 template<
class Derived>
208 {
width_ = (param.empty() ? 1. : param.front());}
234 return hasRun_ ? gram_(
i,
j)
235 : std::exp(-(p_data_->row(
i) - p_data_->row(
j)).norm()/width_);
240{
return std::exp(-std::abs(
v)/width_);}
In this file we define the Interface base class for computing a Kernels.
bool hasRun_
true if run has been used, false otherwise
[Deprecated] The Exponential Kernel is a kernel of the form
Exponential(Array const &data, ExprBase< Derived > const ¶m)
constructor with a constant pointer on the data set
virtual Real comp(int i, int j) const
virtual method implementation.
Real width_
bandwidth of the kernel
virtual Real value(Type const &v) const
compute the value of the kernel for the given value
Real const & width() const
Exponential(Array const *p_data, ExprBase< Derived > const ¶m)
constructor with an array of parameter.
Exponential(Array const &data, Real const &width=1.)
constructor with a constant pointer on the data set
void setWidth(Real const &width)
set the bandwidth of the kernel
IKernelBase< Array > Base
virtual Real diag(int i) const
virtual method.
void setParam(ExprBase< Derived > const ¶m)
Set parameter using an array.
Exponential(Array const *p_data, Real const &width=1.)
constructor with a constant pointer on the data set
virtual ~Exponential()
destructor
Exponential(Real const &width=1.)
Default constructor with the width.
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 Laplace Kernel is a kernel of the form.
IKernelBase< Array > Base
void setParam(ExprBase< Derived > const ¶m)
Set parameter using an array.
void setWidth(Real const &width)
set the bandwidth of the kernel
Real width_
bandwidth of the kernel
virtual Real value(Type const &v) const
compute the value of the kernel for the given value
virtual ~Laplace()
destructor
Laplace(Array const &data, Real const &width=1.)
constructor with a constant pointer on the data set
Laplace(Real const &width=1.)
Default constructor with the width.
virtual Real comp(int i, int j) const
virtual method implementation.
Laplace(Array const *p_data, Real const &width=1.)
constructor with a constant pointer on the data set
Real const & width() const
Laplace(Array const &data, ExprBase< Derived > const ¶m)
constructor with a constant pointer on the data set
Laplace(Array const *p_data, ExprBase< Derived > const ¶m)
constructor with an array of parameter.
virtual Real diag(int i) const
virtual method.
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.