|
SHOGUN
v1.1.0
|
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
.

Public Member Functions | |
| CKRR () | |
| CKRR (float64_t tau, CKernel *k, CLabels *lab) | |
| virtual | ~CKRR () |
| void | set_tau (float64_t t) |
| virtual CLabels * | apply () |
| virtual float64_t | apply (int32_t num) |
| virtual bool | load (FILE *srcfile) |
| virtual bool | save (FILE *dstfile) |
| virtual EClassifierType | get_classifier_type () |
| virtual const char * | get_name () const |
Public Member Functions inherited from CKernelMachine | |
| CKernelMachine () | |
| virtual | ~CKernelMachine () |
| void | set_kernel (CKernel *k) |
| CKernel * | get_kernel () |
| void | set_batch_computation_enabled (bool enable) |
| bool | get_batch_computation_enabled () |
| void | set_linadd_enabled (bool enable) |
| bool | get_linadd_enabled () |
| void | set_bias_enabled (bool enable_bias) |
| bool | get_bias_enabled () |
| float64_t | get_bias () |
| void | set_bias (float64_t bias) |
| int32_t | get_support_vector (int32_t idx) |
| float64_t | get_alpha (int32_t idx) |
| bool | set_support_vector (int32_t idx, int32_t val) |
| bool | set_alpha (int32_t idx, float64_t val) |
| int32_t | get_num_support_vectors () |
| void | set_alphas (SGVector< float64_t > alphas) |
| void | set_support_vectors (SGVector< int32_t > svs) |
| SGVector< int32_t > | get_support_vectors () |
| SGVector< float64_t > | get_alphas () |
| bool | create_new_model (int32_t num) |
| bool | init_kernel_optimization () |
| virtual CLabels * | apply (CFeatures *data) |
Public Member Functions inherited from CMachine | |
| CMachine () | |
| virtual | ~CMachine () |
| virtual bool | train (CFeatures *data=NULL) |
| virtual void | set_labels (CLabels *lab) |
| virtual CLabels * | get_labels () |
| virtual float64_t | get_label (int32_t i) |
| void | set_max_train_time (float64_t t) |
| float64_t | get_max_train_time () |
| void | set_solver_type (ESolverType st) |
| ESolverType | get_solver_type () |
| virtual void | set_store_model_features (bool store_model) |
Public Member Functions inherited from CSGObject | |
| CSGObject () | |
| CSGObject (const CSGObject &orig) | |
| virtual | ~CSGObject () |
| virtual bool | is_generic (EPrimitiveType *generic) const |
| template<class T > | |
| void | set_generic () |
| void | unset_generic () |
| virtual void | print_serializable (const char *prefix="") |
| virtual bool | save_serializable (CSerializableFile *file, const char *prefix="") |
| virtual bool | load_serializable (CSerializableFile *file, const char *prefix="") |
| void | set_global_io (SGIO *io) |
| SGIO * | get_global_io () |
| void | set_global_parallel (Parallel *parallel) |
| Parallel * | get_global_parallel () |
| void | set_global_version (Version *version) |
| Version * | get_global_version () |
| SGVector< char * > | get_modelsel_names () |
| char * | get_modsel_param_descr (const char *param_name) |
| index_t | get_modsel_param_index (const char *param_name) |
Protected Member Functions | |
| virtual bool | train_machine (CFeatures *data=NULL) |
Protected Member Functions inherited from CKernelMachine | |
| virtual void | store_model_features () |
Additional Inherited Members | |
Static Public Member Functions inherited from CKernelMachine | |
| static void * | apply_helper (void *p) |
Public Attributes inherited from CSGObject | |
| SGIO * | io |
| Parallel * | parallel |
| Version * | version |
| Parameter * | m_parameters |
| Parameter * | m_model_selection_parameters |
Protected Attributes inherited from CKernelMachine | |
| CKernel * | kernel |
| bool | use_batch_computation |
| bool | use_linadd |
| bool | use_bias |
| float64_t | m_bias |
| SGVector< float64_t > | m_alpha |
| SGVector< int32_t > | m_svs |
|
virtual |
|
virtual |
classify one example
| num | which example to classify |
Reimplemented from CKernelMachine.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
| void set_tau | ( | float64_t | t | ) |
|
protectedvirtual |