![]() |
UFJF - Machine Learning Toolkit
0.51.8
|
Class for the kernel computations. More...
#include <Kernel.hpp>
Public Member Functions | |
Kernel (int type=0, double param=0) | |
Class constructor. More... | |
mltk::dMatrix * | getKernelMatrixPointer () |
getKernelMatrixPointer Returns a reference to the kernel matrix. More... | |
Kernel (mltk::dMatrix kernel_matrix) | |
Class constructor. More... | |
void | setType (int type) |
setType Set the kernel type used in the kernel computations. More... | |
void | setParam (double param) |
setParam Set the kernel parameter used in the kernel computations. More... | |
int | getType () |
getType Returns the kernel type used in the kernel computations. More... | |
double | getParam () |
getParam Returns the kernel parameter used in the kernel computations. More... | |
void | setKernelMatrix (mltk::dMatrix K) |
setKernelMatrix Set a pre computed kernel matrix. More... | |
mltk::dMatrix | getKernelMatrix () |
getKernelMatrix Get the kernel matrix. More... | |
void | recompute () |
void | compute (std::shared_ptr< Data< T > > samples, typename FunctionType< T >::Type f=nullptr) |
compute Compute the kernel matrix with the given type and parameter. More... | |
mltk::dMatrix * | generateMatrixH (std::shared_ptr< Data< T > > samples) |
compute Compute the H matrix with the computed kernel matrix and given samples. More... | |
mltk::dMatrix * | generateMatrixHwithoutDim (std::shared_ptr< Data< T > > samples, int dim) |
compute Compute the H matrix without a dimension, with the computed kernel matrix and given samples. More... | |
double | function (std::shared_ptr< Point< T > > one, std::shared_ptr< Point< T > > two, int dim, typename FunctionType< T >::Type f=nullptr) const |
function Compute the kernel function between two points. More... | |
double | functionWithoutDim (std::shared_ptr< Point< T > > one, std::shared_ptr< Point< T > > two, int j, int dim) |
function Compute the kernel function between two points without a dimension. More... | |
double | norm (Data< T > data) |
norm Computes norm in dual variables. More... | |
double | featureSpaceNorm (std::shared_ptr< Data< T > > data) |
featureSpaceNorm Computes the norm in the feature space (Dual). More... | |
size_t | size () const |
double | operator() (const Point< T > &a, const Point< T > &b) const |
void | operator() (const Data< T > &samples, typename FunctionType< T >::Type f=nullptr) |
std::vector< double > | operator[] (const size_t &idx) const |
Class for the kernel computations.
mltk::Kernel< T >::Kernel | ( | int | type = 0 , |
double | param = 0 |
||
) |
Class constructor.
mltk::Kernel< T >::Kernel | ( | mltk::dMatrix | kernel_matrix | ) |
Class constructor.
K | Kernel matrix to be set in initialization. |
void mltk::Kernel< T >::compute | ( | std::shared_ptr< Data< T > > | samples, |
typename FunctionType< T >::Type | f = nullptr |
||
) |
compute Compute the kernel matrix with the given type and parameter.
samples | Data used to compute the kernel matrix. |
double mltk::Kernel< T >::featureSpaceNorm | ( | std::shared_ptr< Data< T > > | data | ) |
featureSpaceNorm Computes the norm in the feature space (Dual).
data | Dataset to compute norm. |
double mltk::Kernel< T >::function | ( | std::shared_ptr< Point< T > > | one, |
std::shared_ptr< Point< T > > | two, | ||
int | dim, | ||
typename FunctionType< T >::Type | f = nullptr |
||
) | const |
function Compute the kernel function between two points.
one | first point. |
two | second point. |
dim | Dimension of the points. |
double mltk::Kernel< T >::functionWithoutDim | ( | std::shared_ptr< Point< T > > | one, |
std::shared_ptr< Point< T > > | two, | ||
int | j, | ||
int | dim | ||
) |
function Compute the kernel function between two points without a dimension.
one | first point. |
two | second point. |
j | Dimension to be ignored. |
dim | Dimension of the points. |
mltk::dMatrix * mltk::Kernel< T >::generateMatrixH | ( | std::shared_ptr< Data< T > > | samples | ) |
compute Compute the H matrix with the computed kernel matrix and given samples.
samples | Data used to compute the kernel matrix. |
mltk::dMatrix * mltk::Kernel< T >::generateMatrixHwithoutDim | ( | std::shared_ptr< Data< T > > | samples, |
int | dim | ||
) |
compute Compute the H matrix without a dimension, with the computed kernel matrix and given samples.
samples | Data used to compute the kernel matrix. |
dim | dimension to be ignored. |
mltk::dMatrix mltk::Kernel< T >::getKernelMatrix |
getKernelMatrix Get the kernel matrix.
mltk::dMatrix * mltk::Kernel< T >::getKernelMatrixPointer |
getKernelMatrixPointer Returns a reference to the kernel matrix.
double mltk::Kernel< T >::getParam |
getParam Returns the kernel parameter used in the kernel computations.
int mltk::Kernel< T >::getType |
getType Returns the kernel type used in the kernel computations.
double mltk::Kernel< T >::norm | ( | Data< T > | data | ) |
norm Computes norm in dual variables.
data | Dataset to compute norm. |
void mltk::Kernel< T >::setKernelMatrix | ( | mltk::dMatrix | K | ) |
setKernelMatrix Set a pre computed kernel matrix.
K | Kernel matrix to be set. |
void mltk::Kernel< T >::setParam | ( | double | param | ) |
setParam Set the kernel parameter used in the kernel computations.
param | parameter to be set. |
void mltk::Kernel< T >::setType | ( | int | type | ) |
setType Set the kernel type used in the kernel computations.
type | Kernel type. |