class SubGradientSVM
Definition at line 21 of file SubGradientSVM.h.
Public Member Functions | |
CSubGradientSVM () | |
CSubGradientSVM (float64_t C, CDotFeatures *traindat, CLabels *trainlab) | |
virtual | ~CSubGradientSVM () |
virtual EClassifierType | get_classifier_type () |
virtual bool | train () |
void | set_C (float64_t c1, float64_t c2) |
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 |
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 |
CSubGradientSVM::CSubGradientSVM | ( | ) |
default constructor
Definition at line 27 of file SubGradientSVM.cpp.
CSubGradientSVM::CSubGradientSVM | ( | float64_t | C, | |
CDotFeatures * | traindat, | |||
CLabels * | trainlab | |||
) |
constructor
C | constant C | |
traindat | training features | |
trainlab | labels for training features |
Definition at line 33 of file SubGradientSVM.cpp.
CSubGradientSVM::~CSubGradientSVM | ( | ) | [virtual] |
Definition at line 43 of file SubGradientSVM.cpp.
void CSubGradientSVM::cleanup | ( | ) | [protected] |
de-alloc helper arrays
Definition at line 488 of file SubGradientSVM.cpp.
float64_t CSubGradientSVM::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 289 of file SubGradientSVM.cpp.
float64_t CSubGradientSVM::compute_objective | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
compute svm objective
Definition at line 387 of file SubGradientSVM.cpp.
void CSubGradientSVM::compute_projection | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
compute projection
Definition at line 400 of file SubGradientSVM.cpp.
int32_t CSubGradientSVM::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 80 of file SubGradientSVM.cpp.
bool CSubGradientSVM::get_bias_enabled | ( | ) |
float64_t CSubGradientSVM::get_C1 | ( | ) |
float64_t CSubGradientSVM::get_C2 | ( | ) |
virtual EClassifierType CSubGradientSVM::get_classifier_type | ( | ) | [virtual] |
get classifier type
Reimplemented from CClassifier.
Definition at line 42 of file SubGradientSVM.h.
float64_t CSubGradientSVM::get_epsilon | ( | ) |
virtual const char* CSubGradientSVM::get_name | ( | ) | const [protected, virtual] |
int32_t CSubGradientSVM::get_qpsize | ( | ) |
int32_t CSubGradientSVM::get_qpsize_max | ( | ) |
void CSubGradientSVM::init | ( | int32_t | num_vec, | |
int32_t | num_feat | |||
) | [protected] |
alloc helper arrays
Definition at line 411 of file SubGradientSVM.cpp.
float64_t CSubGradientSVM::line_search | ( | int32_t | num_feat, | |
int32_t | num_vec | |||
) | [protected] |
performs a line search to determine step size
Definition at line 223 of file SubGradientSVM.cpp.
void CSubGradientSVM::set_bias_enabled | ( | bool | enable_bias | ) |
set if bias shall be enabled
enable_bias | if bias shall be enabled |
Definition at line 73 of file SubGradientSVM.h.
void CSubGradientSVM::set_epsilon | ( | float64_t | eps | ) |
void CSubGradientSVM::set_qpsize | ( | int32_t | q | ) |
void CSubGradientSVM::set_qpsize_max | ( | int32_t | q | ) |
bool CSubGradientSVM::train | ( | ) | [virtual] |
train SVM
Reimplemented from CClassifier.
Definition at line 525 of file SubGradientSVM.cpp.
void CSubGradientSVM::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 202 of file SubGradientSVM.cpp.
void CSubGradientSVM::update_projection | ( | float64_t | alpha, | |
int32_t | num_vec | |||
) | [protected] |
only computes updates on the projection
Definition at line 406 of file SubGradientSVM.cpp.
uint8_t* CSubGradientSVM::active [protected] |
0=not active, 1=active, 2=on boundary
Definition at line 182 of file SubGradientSVM.h.
float64_t CSubGradientSVM::autoselected_epsilon [protected] |
autoselected epsilon
Definition at line 165 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::beta [protected] |
beta
Definition at line 224 of file SubGradientSVM.h.
float64_t CSubGradientSVM::C1 [protected] |
C1
Definition at line 157 of file SubGradientSVM.h.
float64_t CSubGradientSVM::C2 [protected] |
C2
Definition at line 159 of file SubGradientSVM.h.
int32_t CSubGradientSVM::delta_active [protected] |
delta active
Definition at line 190 of file SubGradientSVM.h.
int32_t CSubGradientSVM::delta_bound [protected] |
delta bound
Definition at line 192 of file SubGradientSVM.h.
float64_t CSubGradientSVM::epsilon [protected] |
epsilon
Definition at line 161 of file SubGradientSVM.h.
float64_t CSubGradientSVM::grad_b [protected] |
grad b
Definition at line 214 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::grad_proj [protected] |
grad proj
Definition at line 216 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::grad_w [protected] |
grad w
Definition at line 212 of file SubGradientSVM.h.
int32_t* CSubGradientSVM::hinge_idx [protected] |
hinge index
Definition at line 220 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::hinge_point [protected] |
hinge point
Definition at line 218 of file SubGradientSVM.h.
int32_t* CSubGradientSVM::idx_active [protected] |
idx active
Definition at line 186 of file SubGradientSVM.h.
int32_t* CSubGradientSVM::idx_bound [protected] |
idx bound
Definition at line 188 of file SubGradientSVM.h.
int32_t CSubGradientSVM::last_it_noimprovement [protected] |
last iteration no improvement
Definition at line 176 of file SubGradientSVM.h.
int32_t CSubGradientSVM::num_it_noimprovement [protected] |
number of iterations no improvement
Definition at line 178 of file SubGradientSVM.h.
uint8_t* CSubGradientSVM::old_active [protected] |
old active
Definition at line 184 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::old_beta [protected] |
old beta
Definition at line 226 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::old_v [protected] |
old v
Definition at line 206 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::old_Z [protected] |
old Z
Definition at line 234 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::old_Zv [protected] |
old Zv
Definition at line 230 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::proj [protected] |
proj
Definition at line 194 of file SubGradientSVM.h.
int32_t CSubGradientSVM::qpsize [protected] |
qpsize
Definition at line 167 of file SubGradientSVM.h.
int32_t CSubGradientSVM::qpsize_limit [protected] |
limit of qpsize
Definition at line 171 of file SubGradientSVM.h.
int32_t CSubGradientSVM::qpsize_max [protected] |
maximum qpsize
Definition at line 169 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::sum_CXy_active [protected] |
sum CXy active
Definition at line 202 of file SubGradientSVM.h.
float64_t CSubGradientSVM::sum_Cy_active [protected] |
sum Cy active
Definition at line 208 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::tmp_proj [protected] |
tmp proj
Definition at line 196 of file SubGradientSVM.h.
int32_t* CSubGradientSVM::tmp_proj_idx [protected] |
tmp proj index
Definition at line 198 of file SubGradientSVM.h.
bool CSubGradientSVM::use_bias [protected] |
shall bias be used
Definition at line 173 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::v [protected] |
v
Definition at line 204 of file SubGradientSVM.h.
float64_t CSubGradientSVM::work_epsilon [protected] |
work epsilon
Definition at line 163 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::Z [protected] |
Z
Definition at line 232 of file SubGradientSVM.h.
float64_t* CSubGradientSVM::Zv [protected] |
Zv
Definition at line 228 of file SubGradientSVM.h.