A generic KernelMachine interface.
A kernel machine is defined as
where is the number of training examples
are the weights assigned to each training example
is the kernel and
the bias.
Using an a-priori choosen kernel, the and bias are determined in a training procedure.
Definition at line 43 of file KernelMachine.h.
CKernelMachine | ( | ) |
default constructor
Definition at line 28 of file KernelMachine.cpp.
~CKernelMachine | ( | ) | [virtual] |
destructor
Definition at line 44 of file KernelMachine.cpp.
CLabels * apply | ( | ) | [virtual] |
apply kernel machine to all objects
Implements CMachine.
Reimplemented in CMultiClassSVM, and CKRR.
Definition at line 83 of file KernelMachine.cpp.
apply kernel machine to data
data | (test)data to be classified |
Implements CMachine.
Reimplemented in CDomainAdaptationSVM, and CMultiClassSVM.
Definition at line 222 of file KernelMachine.cpp.
float64_t apply | ( | int32_t | num | ) | [virtual] |
apply kernel machine to one example
num | which example to apply to |
Reimplemented from CMachine.
Reimplemented in CMultiClassSVM, CScatterSVM, and CKRR.
Definition at line 202 of file KernelMachine.cpp.
void * apply_helper | ( | void * | p | ) | [static] |
apply example helper, used in threads
p | params of the thread |
Definition at line 239 of file KernelMachine.cpp.
bool create_new_model | ( | int32_t | num | ) |
create new model
num | number of alphas and support vectors in new model |
Definition at line 271 of file KernelMachine.h.
float64_t get_alpha | ( | int32_t | idx | ) |
get alpha at given index
idx | index of alpha |
Definition at line 163 of file KernelMachine.h.
get all alphas
Definition at line 252 of file KernelMachine.h.
bool get_batch_computation_enabled | ( | ) |
check if batch computation is enabled
Definition at line 94 of file KernelMachine.h.
float64_t get_bias | ( | ) |
bool get_bias_enabled | ( | ) |
CKernel* get_kernel | ( | ) |
bool get_linadd_enabled | ( | ) |
check if linadd is enabled
Definition at line 112 of file KernelMachine.h.
virtual const char* get_name | ( | void | ) | const [virtual] |
Returns the name of the SGSerializable instance. It MUST BE the CLASS NAME without the prefixed `C'.
Implements CSGObject.
Reimplemented in CMKL, CDomainAdaptationSVM, CGMNPSVM, CGNPPSVM, CGPBTSVM, CLaRank, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, CScatterSVM, CSVM, CSVMLight, CKRR, CLibSVR, and CSVRLight.
Definition at line 57 of file KernelMachine.h.
int32_t get_num_support_vectors | ( | ) |
get number of support vectors
Definition at line 208 of file KernelMachine.h.
int32_t get_support_vector | ( | int32_t | idx | ) |
get support vector at given index
idx | index of support vector |
Definition at line 152 of file KernelMachine.h.
SGVector<int32_t> get_support_vectors | ( | ) |
get all support vectors
Definition at line 234 of file KernelMachine.h.
bool init_kernel_optimization | ( | ) |
initialise kernel optimisation
Definition at line 52 of file KernelMachine.cpp.
bool set_alpha | ( | int32_t | idx, | |
float64_t | val | |||
) |
set alpha at given index to given value
idx | index of alpha vector | |
val | new value of alpha vector |
Definition at line 194 of file KernelMachine.h.
set alphas to given values
alphas | float vector with all alphas to set |
Definition at line 217 of file KernelMachine.h.
void set_batch_computation_enabled | ( | bool | enable | ) |
set batch computation enabled
enable | if batch computation shall be enabled |
Definition at line 85 of file KernelMachine.h.
void set_bias | ( | float64_t | bias | ) |
void set_bias_enabled | ( | bool | enable_bias | ) |
set state of bias
enable_bias | if bias shall be enabled |
Definition at line 121 of file KernelMachine.h.
void set_kernel | ( | CKernel * | k | ) |
void set_linadd_enabled | ( | bool | enable | ) |
set linadd enabled
enable | if linadd shall be enabled |
Definition at line 103 of file KernelMachine.h.
bool set_support_vector | ( | int32_t | idx, | |
int32_t | val | |||
) |
set support vector at given index to given value
idx | index of support vector | |
val | new value of support vector |
Definition at line 178 of file KernelMachine.h.
void set_support_vectors | ( | SGVector< int32_t > | svs | ) |
set support vectors to given values
svs | integer vector with all support vectors indexes to set |
Definition at line 226 of file KernelMachine.h.
void store_model_features | ( | ) | [protected, virtual] |
Stores feature data of the SV indices and sets it to the lhs of the underlying kernel. Then, all SV indices are set to identity.
Reimplemented from CMachine.
Definition at line 266 of file KernelMachine.cpp.
kernel
Definition at line 329 of file KernelMachine.h.
coefficients alpha
Definition at line 340 of file KernelMachine.h.
bias term b
Definition at line 337 of file KernelMachine.h.
array of ``support vectors'' (indices of feature objects)
Definition at line 343 of file KernelMachine.h.
bool use_batch_computation [protected] |
if batch computation is enabled
Definition at line 331 of file KernelMachine.h.
bool use_bias [protected] |
if bias shall be used
Definition at line 335 of file KernelMachine.h.
bool use_linadd [protected] |
if linadd is enabled
Definition at line 333 of file KernelMachine.h.