UFJF - Machine Learning Toolkit  0.51.8
mltk::Kernel< T > Class Template Reference

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
 

Detailed Description

template<typename T = double>
class mltk::Kernel< T >

Class for the kernel computations.

Constructor & Destructor Documentation

◆ Kernel() [1/2]

template<typename T >
mltk::Kernel< T >::Kernel ( int  type = 0,
double  param = 0 
)

Class constructor.

◆ Kernel() [2/2]

template<typename T >
mltk::Kernel< T >::Kernel ( mltk::dMatrix  kernel_matrix)

Class constructor.

Parameters
KKernel matrix to be set in initialization.

Member Function Documentation

◆ compute()

template<typename T >
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.

Parameters
samplesData used to compute the kernel matrix.

◆ featureSpaceNorm()

template<typename T >
double mltk::Kernel< T >::featureSpaceNorm ( std::shared_ptr< Data< T > >  data)

featureSpaceNorm Computes the norm in the feature space (Dual).

Parameters
dataDataset to compute norm.
Returns
double

◆ function()

template<typename T >
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.

Parameters
onefirst point.
twosecond point.
dimDimension of the points.
Returns
double

◆ functionWithoutDim()

template<typename T = double>
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.

Parameters
onefirst point.
twosecond point.
jDimension to be ignored.
dimDimension of the points.
Returns
double

◆ generateMatrixH()

template<typename T >
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.

Parameters
samplesData used to compute the kernel matrix.
Returns
mltk::dMatrix*

◆ generateMatrixHwithoutDim()

template<typename T = double>
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.

Parameters
samplesData used to compute the kernel matrix.
dimdimension to be ignored.
Returns
mltk::dMatrix*

◆ getKernelMatrix()

template<typename T >
mltk::dMatrix mltk::Kernel< T >::getKernelMatrix

getKernelMatrix Get the kernel matrix.

Returns
std::vector<std::vector<double> >

◆ getKernelMatrixPointer()

template<typename T >
mltk::dMatrix * mltk::Kernel< T >::getKernelMatrixPointer

getKernelMatrixPointer Returns a reference to the kernel matrix.

Returns
mltk::dMatrix*

◆ getParam()

template<typename T >
double mltk::Kernel< T >::getParam

getParam Returns the kernel parameter used in the kernel computations.

Returns
double

◆ getType()

template<typename T >
int mltk::Kernel< T >::getType

getType Returns the kernel type used in the kernel computations.

Returns
int.

◆ norm()

template<typename T >
double mltk::Kernel< T >::norm ( Data< T >  data)

norm Computes norm in dual variables.

Parameters
dataDataset to compute norm.
Returns
double

◆ setKernelMatrix()

template<typename T >
void mltk::Kernel< T >::setKernelMatrix ( mltk::dMatrix  K)

setKernelMatrix Set a pre computed kernel matrix.

Parameters
KKernel matrix to be set.

◆ setParam()

template<typename T >
void mltk::Kernel< T >::setParam ( double  param)

setParam Set the kernel parameter used in the kernel computations.

Parameters
paramparameter to be set.

◆ setType()

template<typename T >
void mltk::Kernel< T >::setType ( int  type)

setType Set the kernel type used in the kernel computations.

Parameters
typeKernel type.

The documentation for this class was generated from the following file: