CSVM Class Reference
List of all members.
Detailed Description
A generic Support Vector Machine Interface
A support vector 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 by solving the following quadratic program
here C is a pre-specified regularization parameter.
Definition at line 43 of file SVM.h.
Constructor & Destructor Documentation
CSVM::CSVM |
( |
int32_t |
num_sv = 0 |
) |
|
Create an empty Support Vector Machine Object
- Parameters:
-
| num_sv | with num_sv support vectors |
Definition at line 33 of file SVM.cpp.
Create a Support Vector Machine Object from a trained SVM
- Parameters:
-
Definition at line 39 of file SVM.cpp.
CSVM::~CSVM |
( |
|
) |
[virtual] |
Member Function Documentation
float64_t CSVM::classify_example |
( |
int32_t |
num |
) |
[virtual] |
classify one example
- Parameters:
-
| num | which example to classify |
- Returns:
- classified value
Reimplemented from CClassifier.
Reimplemented in CMultiClassSVM.
Definition at line 395 of file SVM.cpp.
void * CSVM::classify_example_helper |
( |
void * |
p |
) |
[static] |
classify example helper, used in threads
- Parameters:
-
- Returns:
- nothing really
Definition at line 254 of file SVM.cpp.
compute objective
- Returns:
- computed objective
Definition at line 415 of file SVM.cpp.
bool CSVM::create_new_model |
( |
int32_t |
num |
) |
|
create new model
- Parameters:
-
| num | number of alphas and support vectors in new model |
Definition at line 335 of file SVM.h.
get alpha at given index
- Parameters:
-
- Returns:
- alpha
Definition at line 196 of file SVM.h.
void CSVM::get_alphas |
( |
float64_t ** |
alphas, |
|
|
int32_t * |
d1 | |
|
) |
| | |
get all alphas (swig compatible)
- Parameters:
-
| alphas | array to contain a copy of the alphas |
| d1 | number of alphas in the array |
Definition at line 315 of file SVM.h.
get bias
- Returns:
- bias
Definition at line 238 of file SVM.h.
bool CSVM::get_bias_enabled |
( |
|
) |
|
get state of bias
- Returns:
- state of bias
Definition at line 142 of file SVM.h.
get C1
- Returns:
- C1
Definition at line 166 of file SVM.h.
get C2
- Returns:
- C2
Definition at line 172 of file SVM.h.
get epsilon
- Returns:
- epsilon
Definition at line 154 of file SVM.h.
bool CSVM::get_mkl_enabled |
( |
|
) |
|
get state of mkl
- Returns:
- if mkl is enabled
Definition at line 388 of file SVM.h.
get nu
- Returns:
- nu
Definition at line 160 of file SVM.h.
int32_t CSVM::get_num_support_vectors |
( |
|
) |
|
get number of support vectors
- Returns:
- number of support vectors
Definition at line 256 of file SVM.h.
get objective
- Returns:
- objective
Definition at line 412 of file SVM.h.
int32_t CSVM::get_qpsize |
( |
|
) |
|
get qpsize
- Returns:
- qpsize
Definition at line 178 of file SVM.h.
bool CSVM::get_shrinking_enabled |
( |
|
) |
|
get state of shrinking
- Returns:
- if shrinking is enabled
Definition at line 370 of file SVM.h.
int32_t CSVM::get_support_vector |
( |
int32_t |
idx |
) |
|
get support vector at given index
- Parameters:
-
| idx | index of support vector |
- Returns:
- support vector
Definition at line 185 of file SVM.h.
void CSVM::get_support_vectors |
( |
int32_t ** |
svs, |
|
|
int32_t * |
num | |
|
) |
| | |
get all support vectors (swig compatible)
- Parameters:
-
| svs | array to contain a copy of the support vectors |
| num | number of support vectors in the array |
Definition at line 294 of file SVM.h.
get epsilon for weights
- Returns:
- epsilon for weights
Definition at line 148 of file SVM.h.
bool CSVM::init_kernel_optimization |
( |
|
) |
|
initialise kernel optimisation
- Returns:
- if operation was successful
Definition at line 223 of file SVM.cpp.
bool CSVM::load |
( |
FILE * |
svm_file |
) |
[virtual] |
bool CSVM::save |
( |
FILE * |
svm_file |
) |
[virtual] |
bool CSVM::set_alpha |
( |
int32_t |
idx, |
|
|
float64_t |
val | |
|
) |
| | |
set alpha at given index to given value
- Parameters:
-
| idx | index of alpha vector |
| val | new value of alpha vector |
- Returns:
- if operation was successful
Definition at line 224 of file SVM.h.
void CSVM::set_alphas |
( |
float64_t * |
alphas, |
|
|
int32_t |
d | |
|
) |
| | |
set alphas to given values
- Parameters:
-
| alphas | array with all alphas to set |
| d | number of alphas (== number of support vectors) |
Definition at line 266 of file SVM.h.
set bias to given value
- Parameters:
-
Definition at line 247 of file SVM.h.
void CSVM::set_bias_enabled |
( |
bool |
enable_bias |
) |
|
set state of bias
- Parameters:
-
| enable_bias | if bias shall be enabled |
Definition at line 136 of file SVM.h.
set C
- Parameters:
-
| c1 | new C constant for negatively labelled examples |
| c2 | new C constant for positively labelled examples |
Note that not all SVMs support this (however at least
CLibSVM and CSVMLight do)
Definition at line 89 of file SVM.h.
set C mkl
- Parameters:
-
Definition at line 113 of file SVM.h.
void CSVM::set_defaults |
( |
int32_t |
num_sv = 0 |
) |
|
set default values for members a SVM object
Definition at line 56 of file SVM.cpp.
set epsilon
- Parameters:
-
Definition at line 101 of file SVM.h.
void CSVM::set_mkl_enabled |
( |
bool |
enable |
) |
|
set state of mkl
- Parameters:
-
| enable | if mkl shall be enabled |
Definition at line 379 of file SVM.h.
void CSVM::set_mkl_norm |
( |
int32_t |
norm |
) |
|
set mkl norm
- Parameters:
-
| norm | new mkl norm (1 or 2) |
Definition at line 119 of file SVM.h.
set nu
- Parameters:
-
Definition at line 79 of file SVM.h.
set objective
- Parameters:
-
Definition at line 403 of file SVM.h.
void CSVM::set_qpsize |
( |
int32_t |
qps |
) |
|
set qpsize
- Parameters:
-
Definition at line 130 of file SVM.h.
void CSVM::set_shrinking_enabled |
( |
bool |
enable |
) |
|
set state of shrinking
- Parameters:
-
| enable | if shrinking will be enabled |
Definition at line 361 of file SVM.h.
bool CSVM::set_support_vector |
( |
int32_t |
idx, |
|
|
int32_t |
val | |
|
) |
| | |
set support vector at given index to given value
- Parameters:
-
| idx | index of support vector |
| val | new value of support vector |
- Returns:
- if operation was successful
Definition at line 208 of file SVM.h.
void CSVM::set_support_vectors |
( |
int32_t * |
svs, |
|
|
int32_t |
d | |
|
) |
| | |
set support vectors to given values
- Parameters:
-
| svs | array with all support vectors to set |
| d | number of support vectors |
Definition at line 280 of file SVM.h.
void CSVM::set_tube_epsilon |
( |
float64_t |
eps |
) |
|
set tube epsilon
- Parameters:
-
Definition at line 107 of file SVM.h.
void CSVM::set_weight_epsilon |
( |
float64_t |
eps |
) |
|
set epsilon for weights
- Parameters:
-
Definition at line 95 of file SVM.h.
Member Data Documentation
C1 regularization const
Definition at line 472 of file SVM.h.
C2
Definition at line 474 of file SVM.h.
C_mkl
Definition at line 478 of file SVM.h.
epsilon
Definition at line 466 of file SVM.h.
norm used in mkl, can be 1 or 2
Definition at line 476 of file SVM.h.
nu
Definition at line 470 of file SVM.h.
objective
Definition at line 480 of file SVM.h.
qpsize
Definition at line 482 of file SVM.h.
if SVM is loaded
Definition at line 462 of file SVM.h.
tube epsilon for support vector regression
Definition at line 468 of file SVM.h.
if bias shall be used
Definition at line 484 of file SVM.h.
if mkl shall be used
Definition at line 488 of file SVM.h.
if shrinking shall be used
Definition at line 486 of file SVM.h.
epsilon for multiple kernel learning
Definition at line 464 of file SVM.h.
The documentation for this class was generated from the following files: