STK++ 0.9.13
STK::Kernel::IKernel Class Referenceabstract

Interface class for the kernels classes. More...

#include <STK_Kernel_IKernel.h>

Inheritance diagram for STK::Kernel::IKernel:
Inheritance graph

Public Member Functions

 IKernel ()
 default constructor
 
 IKernel (IKernel const &kernel)
 copy constructor
 
virtual ~IKernel ()
 destructor
 
CSquareX const & k () const
 
CSquareX const & gram () const
 
Real kcomp (int i, int j) const
 
Real kdist (int i, int j) const
 
Real kdiag (int i) const
 
virtual Real comp (int i, int j) const =0
 pure virtual method.
 
Real dist (int i, int j) const
 
virtual Real diag (int i) const
 virtual method.
 
virtual int nbSample () const =0
 pure virtual method.
 
virtual int nbVariable () const =0
 pure virtual method.
 
- Public Member Functions inherited from STK::IRunnerBase
String const & error () const
 get the last error message.
 
virtual bool run ()=0
 run the computations.
 

Protected Attributes

CSquareX gram_
 the resulting gram_ matrix
 
- Protected Attributes inherited from STK::IRunnerBase
String msg_error_
 String with the last error message.
 
bool hasRun_
 true if run has been used, false otherwise
 

Additional Inherited Members

- Protected Member Functions inherited from STK::IRunnerBase
 IRunnerBase ()
 default constructor
 
 IRunnerBase (IRunnerBase const &runner)
 copy constructor
 
virtual ~IRunnerBase ()
 destructor
 
virtual void update ()
 update the runner.
 

Detailed Description

Interface class for the kernels classes.

A positive definite kernel is a generalization of a positive definite function or positive-definite matrix.

Let $ \mathcal X $ be a nonempty set, sometimes referred to as the index set. A symmetric function $ K: \mathcal X \times \mathcal X \to \mathbb{R}$ is called a positive definite (p.d.) kernel on $\mathcal X$ if $\sum_{i,j=1}^n c_i c_j K(x_i, x_j) \ge 0$ holds for any $ n\in \mathbb{N}, x_1, \dots, x_n\in \mathcal X, c_1, \dots, c_n \in \mathbb{R}$.

Definition at line 59 of file STK_Kernel_IKernel.h.

Constructor & Destructor Documentation

◆ IKernel() [1/2]

STK::Kernel::IKernel::IKernel ( )
inline

default constructor

Definition at line 63 of file STK_Kernel_IKernel.h.

63: IRunnerBase(), gram_() {}
IRunnerBase()
default constructor
Definition STK_IRunner.h:68
CSquareX gram_
the resulting gram_ matrix

◆ IKernel() [2/2]

STK::Kernel::IKernel::IKernel ( IKernel const &  kernel)
inline

copy constructor

Parameters
kernelkernel to copy

Definition at line 67 of file STK_Kernel_IKernel.h.

67: IRunnerBase(kernel), gram_(kernel.gram_) {}

◆ ~IKernel()

virtual STK::Kernel::IKernel::~IKernel ( )
inlinevirtual

destructor

Definition at line 69 of file STK_Kernel_IKernel.h.

69{}

Member Function Documentation

◆ comp()

virtual Real STK::Kernel::IKernel::comp ( int  i,
int  j 
) const
pure virtual

pure virtual method.

Returns
compute the value of the kernel for the ith and jth individuals.
Parameters
i,jindexes of the individuals

Implemented in STK::Kernel::Gaussian< Array >, STK::Kernel::Hamming< Array >, STK::Kernel::Laplace< Array >, STK::Kernel::Exponential< Array >, STK::Kernel::Linear< Array >, STK::Kernel::Polynomial< Array >, and STK::Kernel::RationalQuadratic< Array >.

Referenced by diag(), and dist().

◆ diag()

virtual Real STK::Kernel::IKernel::diag ( int  i) const
inlinevirtual

virtual method.

Returns
diagonal value of the kernel for the ith individuals.
Parameters
iindex of the individual

Reimplemented in STK::Kernel::Gaussian< Array >, STK::Kernel::Hamming< Array >, STK::Kernel::Laplace< Array >, STK::Kernel::Exponential< Array >, STK::Kernel::Linear< Array >, STK::Kernel::Polynomial< Array >, and STK::Kernel::RationalQuadratic< Array >.

Definition at line 109 of file STK_Kernel_IKernel.h.

109{ return comp(i,i);};
virtual Real comp(int i, int j) const =0
pure virtual method.

References comp().

◆ dist()

Real STK::Kernel::IKernel::dist ( int  i,
int  j 
) const
inline
Returns
compute the kernel distance between the ith and jth individuals.
Parameters
i,jindexes of the individuals

Definition at line 104 of file STK_Kernel_IKernel.h.

104{ return comp(i,i)+comp(j,j)-2*comp(i,j);}

References comp().

◆ gram()

CSquareX const & STK::Kernel::IKernel::gram ( ) const
inline
Returns
the gram matrix (bis)
Note
if the run method is not used, the gram matrix is empty

Definition at line 79 of file STK_Kernel_IKernel.h.

79{ return gram_;}

References gram_.

◆ k()

CSquareX const & STK::Kernel::IKernel::k ( ) const
inline
Returns
the gram matrix
Note
if the run method is not used, the gram matrix is empty

Definition at line 75 of file STK_Kernel_IKernel.h.

75{ return gram_;}

References gram_.

◆ kcomp()

Real STK::Kernel::IKernel::kcomp ( int  i,
int  j 
) const
inline
Returns
computed value of the kernel for the ith and jth individuals.
Parameters
i,jindexes of the individuals

Definition at line 85 of file STK_Kernel_IKernel.h.

85{ return gram_(i,j);}

References gram_.

◆ kdiag()

Real STK::Kernel::IKernel::kdiag ( int  i) const
inline
Returns
diagonal value of the kernel for the ith individuals.
Parameters
iindex of the individual

Definition at line 93 of file STK_Kernel_IKernel.h.

93{ return gram_(i,i);};

References gram_.

◆ kdist()

Real STK::Kernel::IKernel::kdist ( int  i,
int  j 
) const
inline
Returns
computed kernel distance between the ith and jth individuals.
Parameters
i,jindexes of the individuals

Definition at line 89 of file STK_Kernel_IKernel.h.

89{ return gram_(i,i)+gram_(j,j)-2*gram_(i,j);}

References gram_.

◆ nbSample()

virtual int STK::Kernel::IKernel::nbSample ( ) const
pure virtual

pure virtual method.

Returns
the number of samples (the number of rows in the data set)

Implemented in STK::Kernel::IKernelBase< Array >.

Referenced by STK::KernelHandler::addKernel(), and STK::KernelHandler::addKernel().

◆ nbVariable()

virtual int STK::Kernel::IKernel::nbVariable ( ) const
pure virtual

pure virtual method.

Returns
the number of variables (the number of columns in the data set)

Implemented in STK::Kernel::IKernelBase< Array >.

Member Data Documentation

◆ gram_

CSquareX STK::Kernel::IKernel::gram_
protected

the resulting gram_ matrix

Definition at line 123 of file STK_Kernel_IKernel.h.

Referenced by gram(), k(), kcomp(), kdiag(), and kdist().


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