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
which is boils down to solving a linear system
and in the kernel case
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 .
Definition at line 54 of file KRR.h.
Public Member Functions | |
CKRR () | |
CKRR (float64_t tau, CKernel *k, CLabels *lab) | |
virtual | ~CKRR () |
void | set_tau (float64_t t) |
virtual bool | train (CFeatures *data=NULL) |
virtual CLabels * | classify () |
virtual float64_t | classify_example (int32_t num) |
virtual CLabels * | classify (CFeatures *data) |
virtual bool | load (FILE *srcfile) |
virtual bool | save (FILE *dstfile) |
virtual EClassifierType | get_classifier_type () |
virtual const char * | get_name () const |
classify objects
data | (test)data to be classified |
Reimplemented from CKernelMachine.
CLabels * classify | ( | ) | [virtual] |
float64_t classify_example | ( | int32_t | num | ) | [virtual] |
classify one example
num | which example to classify |
Reimplemented from CKernelMachine.
virtual EClassifierType get_classifier_type | ( | ) | [virtual] |
virtual const char* get_name | ( | ) | const [virtual] |
bool load | ( | FILE * | srcfile | ) | [virtual] |
load regression from file
srcfile | file to load from |
Reimplemented from CClassifier.
bool save | ( | FILE * | dstfile | ) | [virtual] |
save regression to file
dstfile | file to save to |
Reimplemented from CClassifier.
void set_tau | ( | float64_t | t | ) |
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) |
Reimplemented from CClassifier.