class SubGradientSVM
Definition at line 23 of file SubGradientSVM.h.
Public Member Functions | |
CSubGradientSVM () | |
CSubGradientSVM (float64_t C, CDotFeatures *traindat, CLabels *trainlab) | |
virtual | ~CSubGradientSVM () |
virtual EClassifierType | get_classifier_type () |
void | set_C (float64_t c_neg, float64_t c_pos) |
float64_t | get_C1 () |
float64_t | get_C2 () |
void | set_bias_enabled (bool enable_bias) |
bool | get_bias_enabled () |
void | set_epsilon (float64_t eps) |
float64_t | get_epsilon () |
void | set_qpsize (int32_t q) |
int32_t | get_qpsize () |
void | set_qpsize_max (int32_t q) |
int32_t | get_qpsize_max () |
Protected Member Functions | |
int32_t | find_active (int32_t num_feat, int32_t num_vec, int32_t &num_active, int32_t &num_bound) |
void | update_active (int32_t num_feat, int32_t num_vec) |
float64_t | compute_objective (int32_t num_feat, int32_t num_vec) |
compute svm objective | |
float64_t | compute_min_subgradient (int32_t num_feat, int32_t num_vec, int32_t num_active, int32_t num_bound) |
float64_t | line_search (int32_t num_feat, int32_t num_vec) |
performs a line search to determine step size | |
void | compute_projection (int32_t num_feat, int32_t num_vec) |
compute projection | |
void | update_projection (float64_t alpha, int32_t num_vec) |
only computes updates on the projection | |
void | init (int32_t num_vec, int32_t num_feat) |
alloc helper arrays | |
void | cleanup () |
de-alloc helper arrays | |
virtual const char * | get_name () const |
virtual bool | train_machine (CFeatures *data=NULL) |
Protected Attributes | |
float64_t | C1 |
float64_t | C2 |
float64_t | epsilon |
float64_t | work_epsilon |
float64_t | autoselected_epsilon |
int32_t | qpsize |
int32_t | qpsize_max |
int32_t | qpsize_limit |
bool | use_bias |
int32_t | last_it_noimprovement |
int32_t | num_it_noimprovement |
uint8_t * | active |
uint8_t * | old_active |
int32_t * | idx_active |
int32_t * | idx_bound |
int32_t | delta_active |
int32_t | delta_bound |
float64_t * | proj |
float64_t * | tmp_proj |
int32_t * | tmp_proj_idx |
float64_t * | sum_CXy_active |
float64_t * | v |
float64_t * | old_v |
float64_t | sum_Cy_active |
float64_t * | grad_w |
float64_t | grad_b |
float64_t * | grad_proj |
float64_t * | hinge_point |
int32_t * | hinge_idx |
float64_t * | beta |
float64_t * | old_beta |
float64_t * | Zv |
float64_t * | old_Zv |
float64_t * | Z |
float64_t * | old_Z |
float64_t | tim |
CSubGradientSVM | ( | ) |
default constructor
Definition at line 26 of file SubGradientSVM.cpp.
CSubGradientSVM | ( | float64_t | C, | |
CDotFeatures * | traindat, | |||
CLabels * | trainlab | |||
) |
constructor
C | constant C | |
traindat | training features | |
trainlab | labels for training features |
Definition at line 32 of file SubGradientSVM.cpp.
~CSubGradientSVM | ( | ) | [virtual] |
Definition at line 42 of file SubGradientSVM.cpp.
void cleanup | ( | ) | [protected] |
de-alloc helper arrays
Definition at line 493 of file SubGradientSVM.cpp.
float64_t compute_min_subgradient | ( | int32_t | num_feat, | |
int32_t | num_vec, | |||
int32_t | num_active, | |||
int32_t | num_bound | |||
) | [protected] |
compute minimum norm subgradient return norm of minimum norm subgradient
Definition at line 288 of file SubGradientSVM.cpp.
float64_t compute_objective | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
compute svm objective
Definition at line 392 of file SubGradientSVM.cpp.
void compute_projection | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
compute projection
Definition at line 405 of file SubGradientSVM.cpp.
int32_t find_active | ( | int32_t | num_feat, | |
int32_t | num_vec, | |||
int32_t & | num_active, | |||
int32_t & | num_bound | |||
) | [protected] |
returns number of changed constraints for precision work_epsilon and fills active array
Definition at line 79 of file SubGradientSVM.cpp.
bool get_bias_enabled | ( | ) |
float64_t get_C1 | ( | ) |
float64_t get_C2 | ( | ) |
virtual EClassifierType get_classifier_type | ( | ) | [virtual] |
get classifier type
Reimplemented from CMachine.
Definition at line 44 of file SubGradientSVM.h.
float64_t get_epsilon | ( | ) |
virtual const char* get_name | ( | void | ) | const [protected, virtual] |
Reimplemented from CLinearMachine.
Definition at line 150 of file SubGradientSVM.h.
int32_t get_qpsize | ( | ) |
int32_t get_qpsize_max | ( | ) |
void init | ( | int32_t | num_vec, | |
int32_t | num_feat | |||
) | [protected] |
alloc helper arrays
Definition at line 416 of file SubGradientSVM.cpp.
float64_t line_search | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
performs a line search to determine step size
Definition at line 222 of file SubGradientSVM.cpp.
void set_bias_enabled | ( | bool | enable_bias | ) |
set if bias shall be enabled
enable_bias | if bias shall be enabled |
Definition at line 70 of file SubGradientSVM.h.
void set_epsilon | ( | float64_t | eps | ) |
void set_qpsize | ( | int32_t | q | ) |
void set_qpsize_max | ( | int32_t | q | ) |
bool train_machine | ( | CFeatures * | data = NULL |
) | [protected, virtual] |
train SVM classifier
data | training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data) |
Reimplemented from CMachine.
Definition at line 530 of file SubGradientSVM.cpp.
void update_active | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
swaps the active / old_active and computes idx_active, idx_bound and sum_CXy_active arrays and the sum_Cy_active variable
Definition at line 201 of file SubGradientSVM.cpp.
void update_projection | ( | float64_t | alpha, | |
int32_t | num_vec | |||
) | [protected] |
only computes updates on the projection
Definition at line 411 of file SubGradientSVM.cpp.
uint8_t* active [protected] |
0=not active, 1=active, 2=on boundary
Definition at line 190 of file SubGradientSVM.h.
float64_t autoselected_epsilon [protected] |
autoselected epsilon
Definition at line 173 of file SubGradientSVM.h.
beta
Definition at line 232 of file SubGradientSVM.h.
C1
Definition at line 165 of file SubGradientSVM.h.
C2
Definition at line 167 of file SubGradientSVM.h.
int32_t delta_active [protected] |
delta active
Definition at line 198 of file SubGradientSVM.h.
int32_t delta_bound [protected] |
delta bound
Definition at line 200 of file SubGradientSVM.h.
epsilon
Definition at line 169 of file SubGradientSVM.h.
grad b
Definition at line 222 of file SubGradientSVM.h.
grad proj
Definition at line 224 of file SubGradientSVM.h.
grad w
Definition at line 220 of file SubGradientSVM.h.
int32_t* hinge_idx [protected] |
hinge index
Definition at line 228 of file SubGradientSVM.h.
float64_t* hinge_point [protected] |
hinge point
Definition at line 226 of file SubGradientSVM.h.
int32_t* idx_active [protected] |
idx active
Definition at line 194 of file SubGradientSVM.h.
int32_t* idx_bound [protected] |
idx bound
Definition at line 196 of file SubGradientSVM.h.
int32_t last_it_noimprovement [protected] |
last iteration no improvement
Definition at line 184 of file SubGradientSVM.h.
int32_t num_it_noimprovement [protected] |
number of iterations no improvement
Definition at line 186 of file SubGradientSVM.h.
uint8_t* old_active [protected] |
old active
Definition at line 192 of file SubGradientSVM.h.
old beta
Definition at line 234 of file SubGradientSVM.h.
old v
Definition at line 214 of file SubGradientSVM.h.
old Z
Definition at line 242 of file SubGradientSVM.h.
old Zv
Definition at line 238 of file SubGradientSVM.h.
proj
Definition at line 202 of file SubGradientSVM.h.
int32_t qpsize [protected] |
qpsize
Definition at line 175 of file SubGradientSVM.h.
int32_t qpsize_limit [protected] |
limit of qpsize
Definition at line 179 of file SubGradientSVM.h.
int32_t qpsize_max [protected] |
maximum qpsize
Definition at line 177 of file SubGradientSVM.h.
float64_t* sum_CXy_active [protected] |
sum CXy active
Definition at line 210 of file SubGradientSVM.h.
float64_t sum_Cy_active [protected] |
sum Cy active
Definition at line 216 of file SubGradientSVM.h.
timing measurement
Definition at line 245 of file SubGradientSVM.h.
tmp proj
Definition at line 204 of file SubGradientSVM.h.
int32_t* tmp_proj_idx [protected] |
tmp proj index
Definition at line 206 of file SubGradientSVM.h.
bool use_bias [protected] |
shall bias be used
Definition at line 181 of file SubGradientSVM.h.
v
Definition at line 212 of file SubGradientSVM.h.
float64_t work_epsilon [protected] |
work epsilon
Definition at line 171 of file SubGradientSVM.h.
Z
Definition at line 240 of file SubGradientSVM.h.
Zv
Definition at line 236 of file SubGradientSVM.h.