36#ifndef STK_KERNEL_RATIONALQUADRATIC_H
37#define STK_KERNEL_RATIONALQUADRATIC_H
58 typedef typename Array::Type
Type;
91 template<
class Derived>
99 template<
class Derived>
101 :
Base(data),
shift_(param.empty() ? 1. : param.front())
113 template<
class Derived>
115 {
shift_ = (param.empty() ? 1. : param.front());}
139 if (hasRun_)
return gram_(
i,
j);
140 Real aux = (p_data_->row(
i) - p_data_->row(
j)).norm2();
141 return 1. -
aux/(
aux + shift_);
146{
return 1-
v*
v/(
v*
v + shift_);}
In this file we define the Interface base class for computing a Kernels.
#define STKDOMAIN_ERROR_1ARG(Where, Arg, Error)
bool hasRun_
true if run has been used, false otherwise
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 RationalQuadratic Kernel is a kernel of the form.
IKernelBase< Array > Base
void setShift(Real const &shift)
set the shift of the kernel
RationalQuadratic(Array const &data, ExprBase< Derived > const ¶m)
constructor with a constant pointer on the data set
virtual Real comp(int i, int j) const
compute the kernel value between two individuals
virtual Real value(Type const &v) const
compute the value of the kernel for the given value
void setParam(ExprBase< Derived > const ¶m)
Set parameter using an array.
Real const & shift() const
virtual ~RationalQuadratic()
destructor
virtual Real diag(int i) const
virtual method.
RationalQuadratic(Array const &data, Real const &shift=1.)
constructor with a constant pointer on the data set
Real shift_
shift of the kernel
RationalQuadratic(Real const &shift=1.)
Default constructor with the width.
RationalQuadratic(Array const *p_data, ExprBase< Derived > const ¶m)
constructor with an array of parameter.
RationalQuadratic(Array const *p_data, Real const &shift=1.)
constructor with a constant pointer on the data set
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.