CKRR类参考


详细描述

Class KRR implements Kernel Ridge Regression - a regularized least square method for classification and regression.

It is similar to support vector machines (cf. CSVM). However in contrast to SVMs a different objective is optimized that leads to a dense solution (thus not only a few support vectors are active in the end but all training examples). This makes it only applicable to rather few (a couple of thousand) training examples. In case a linear kernel is used RR is closely related to Fishers Linear Discriminant (cf. LDA).

Internally (for linear kernels) it is solved via minimizing the following system

\[ \frac{1}{2}\left(\sum_{i=1}^N(y_i-{\bf w}\cdot {\bf x}_i)^2 + \tau||{\bf w}||^2\right) \]

which is boils down to solving a linear system

\[ {\bf w} = \left(\tau {\bf I}+ \sum_{i=1}^N{\bf x}_i{\bf x}_i^T\right)^{-1}\left(\sum_{i=1}^N y_i{\bf x}_i\right) \]

and in the kernel case

\[ {\bf \alpha}=\left({\bf K}+\tau{\bf I}\right)^{-1}{\bf y} \]

where K is the kernel matrix and y the vector of labels. The expressed solution can again be written as a linear combination of kernels (cf. CKernelMachine) with bias $b=0$.

在文件KRR.h54行定义。

继承图,类CKRR
Inheritance graph
[图例]

所有成员的列表。

公有成员

 CKRR ()
 CKRR (float64_t tau, CKernel *k, CLabels *lab)
virtual ~CKRR ()
void set_tau (float64_t t)
virtual bool train (CFeatures *data=NULL)
virtual CLabelsclassify ()
virtual float64_t classify_example (int32_t num)
virtual CLabelsclassify (CFeatures *data)
virtual bool load (FILE *srcfile)
virtual bool save (FILE *dstfile)
virtual EClassifierType get_classifier_type ()
virtual const char * get_name () const

构造及析构函数文档

CKRR (  ) 

default constructor

在文件KRR.cpp21行定义。

CKRR ( float64_t  tau,
CKernel k,
CLabels lab 
)

constructor

参数:
tau regularization constant tau
k kernel
lab labels

在文件KRR.cpp28行定义。

~CKRR (  )  [virtual]

在文件KRR.cpp38行定义。


成员函数文档

virtual CLabels* classify ( CFeatures data  )  [virtual]

classify objects

参数:
data (test)data to be classified
返回:
classified labels

重载CKernelMachine

在文件KRR.h103行定义。

CLabels * classify (  )  [virtual]

classify regression

返回:
resulting labels

重载CKernelMachine

在文件KRR.cpp86行定义。

float64_t classify_example ( int32_t  num  )  [virtual]

classify one example

参数:
num which example to classify
返回:
result

重载CKernelMachine

在文件KRR.cpp116行定义。

virtual EClassifierType get_classifier_type (  )  [virtual]

get classifier type

返回:
classifier type KRR

重载CClassifier

在文件KRR.h126行定义。

virtual const char* get_name (  )  const [virtual]
返回:
object name

实现了CSGObject

在文件KRR.h132行定义。

bool load ( FILE *  srcfile  )  [virtual]

load regression from file

参数:
srcfile file to load from
返回:
if loading was successful

重载CClassifier

在文件KRR.cpp76行定义。

bool save ( FILE *  dstfile  )  [virtual]

save regression to file

参数:
dstfile file to save to
返回:
if saving was successful

重载CClassifier

在文件KRR.cpp81行定义。

void set_tau ( float64_t  t  ) 

set regularization constant

参数:
t new tau

在文件KRR.h73行定义。

bool train ( CFeatures data = NULL  )  [virtual]

train regression

参数:
data training data (parameter can be avoided if distance or kernel-based regressors are used and distance/kernels are initialized with train data)
返回:
whether training was successful

重载CClassifier

在文件KRR.cpp43行定义。


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation