Class SubGradientSVM trains a linear classifier called Linear Programming Machine, i.e. a SVM using a
norm regularizer.
It solves the following optimization problem using subgradient descent.
Note that this implementation is not very stable numerically for a large number of dimensions. Also note that currently CPLEX is required to solve this problem.
在文件SubGradientLPM.h第48行定义。

公有成员 | |
| CSubGradientLPM () | |
| CSubGradientLPM (float64_t C, CDotFeatures *traindat, CLabels *trainlab) | |
| virtual | ~CSubGradientLPM () |
| virtual EClassifierType | get_classifier_type () |
| virtual bool | train (CFeatures *data=NULL) |
| 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 () |
保护成员 | |
| 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 |
保护属性 | |
| 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 |
| int32_t | pos_idx |
| int32_t | neg_idx |
| int32_t | zero_idx |
| int32_t * | w_pos |
| int32_t * | w_zero |
| int32_t * | w_neg |
| float64_t * | grad_w |
| float64_t | grad_b |
| float64_t * | grad_proj |
| float64_t * | hinge_point |
| int32_t * | hinge_idx |
| float64_t * | beta |
| CCplex * | solver |
| float64_t | lpmtim |
| CSubGradientLPM | ( | ) |
在文件SubGradientLPM.cpp第29行定义。
| CSubGradientLPM | ( | float64_t | C, | |
| CDotFeatures * | traindat, | |||
| CLabels * | trainlab | |||
| ) |
在文件SubGradientLPM.cpp第35行定义。
| ~CSubGradientLPM | ( | ) | [virtual] |
在文件SubGradientLPM.cpp第45行定义。
| void cleanup | ( | ) | [protected] |
de-alloc helper arrays
在文件SubGradientLPM.cpp第501行定义。
| 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
在文件SubGradientLPM.cpp第325行定义。
| float64_t compute_objective | ( | int32_t | num_feat, | |
| int32_t | num_vec | |||
| ) | [protected] |
compute svm objective
在文件SubGradientLPM.cpp第411行定义。
| void compute_projection | ( | int32_t | num_feat, | |
| int32_t | num_vec | |||
| ) | [protected] |
compute projection
在文件SubGradientLPM.cpp第424行定义。
| 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
在文件SubGradientLPM.cpp第50行定义。
| bool get_bias_enabled | ( | ) |
在文件SubGradientLPM.h第81行定义。
| float64_t get_C1 | ( | ) |
在文件SubGradientLPM.h第77行定义。
| float64_t get_C2 | ( | ) |
在文件SubGradientLPM.h第78行定义。
| virtual EClassifierType get_classifier_type | ( | ) | [virtual] |
| float64_t get_epsilon | ( | ) |
在文件SubGradientLPM.h第84行定义。
| virtual const char* get_name | ( | ) | const [protected, virtual] |
| int32_t get_qpsize | ( | ) |
在文件SubGradientLPM.h第87行定义。
| int32_t get_qpsize_max | ( | ) |
在文件SubGradientLPM.h第90行定义。
| void init | ( | int32_t | num_vec, | |
| int32_t | num_feat | |||
| ) | [protected] |
alloc helper arrays
在文件SubGradientLPM.cpp第435行定义。
| float64_t line_search | ( | int32_t | num_feat, | |
| int32_t | num_vec | |||
| ) | [protected] |
performs a line search to determine step size
在文件SubGradientLPM.cpp第242行定义。
| void set_bias_enabled | ( | bool | enable_bias | ) |
在文件SubGradientLPM.h第80行定义。
set C
| c_neg | new C constant for negatively labeled examples | |
| c_pos | new C constant for positively labeled examples |
在文件SubGradientLPM.h第75行定义。
| void set_epsilon | ( | float64_t | eps | ) |
在文件SubGradientLPM.h第83行定义。
| void set_qpsize | ( | int32_t | q | ) |
在文件SubGradientLPM.h第86行定义。
| void set_qpsize_max | ( | int32_t | q | ) |
在文件SubGradientLPM.h第89行定义。
| bool train | ( | CFeatures * | data = NULL |
) | [virtual] |
train classifier
| data | training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data) |
重载CClassifier。
在文件SubGradientLPM.cpp第541行定义。
| 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
在文件SubGradientLPM.cpp第221行定义。
| void update_projection | ( | float64_t | alpha, | |
| int32_t | num_vec | |||
| ) | [protected] |
only computes updates on the projection
在文件SubGradientLPM.cpp第430行定义。
uint8_t* active [protected] |
在文件SubGradientLPM.h第145行定义。
float64_t autoselected_epsilon [protected] |
在文件SubGradientLPM.h第135行定义。
在文件SubGradientLPM.h第175行定义。
在文件SubGradientLPM.h第131行定义。
在文件SubGradientLPM.h第132行定义。
int32_t delta_active [protected] |
在文件SubGradientLPM.h第149行定义。
int32_t delta_bound [protected] |
在文件SubGradientLPM.h第150行定义。
在文件SubGradientLPM.h第133行定义。
在文件SubGradientLPM.h第169行定义。
在文件SubGradientLPM.h第170行定义。
在文件SubGradientLPM.h第168行定义。
int32_t* hinge_idx [protected] |
在文件SubGradientLPM.h第172行定义。
float64_t* hinge_point [protected] |
在文件SubGradientLPM.h第171行定义。
int32_t* idx_active [protected] |
在文件SubGradientLPM.h第147行定义。
int32_t* idx_bound [protected] |
在文件SubGradientLPM.h第148行定义。
int32_t last_it_noimprovement [protected] |
在文件SubGradientLPM.h第141行定义。
在文件SubGradientLPM.h第178行定义。
int32_t neg_idx [protected] |
在文件SubGradientLPM.h第163行定义。
int32_t num_it_noimprovement [protected] |
在文件SubGradientLPM.h第142行定义。
uint8_t* old_active [protected] |
在文件SubGradientLPM.h第146行定义。
在文件SubGradientLPM.h第158行定义。
int32_t pos_idx [protected] |
在文件SubGradientLPM.h第162行定义。
在文件SubGradientLPM.h第151行定义。
int32_t qpsize [protected] |
在文件SubGradientLPM.h第136行定义。
int32_t qpsize_limit [protected] |
在文件SubGradientLPM.h第138行定义。
int32_t qpsize_max [protected] |
在文件SubGradientLPM.h第137行定义。
在文件SubGradientLPM.h第177行定义。
float64_t* sum_CXy_active [protected] |
在文件SubGradientLPM.h第156行定义。
float64_t sum_Cy_active [protected] |
在文件SubGradientLPM.h第159行定义。
在文件SubGradientLPM.h第152行定义。
int32_t* tmp_proj_idx [protected] |
在文件SubGradientLPM.h第153行定义。
bool use_bias [protected] |
在文件SubGradientLPM.h第139行定义。
在文件SubGradientLPM.h第157行定义。
int32_t* w_neg [protected] |
在文件SubGradientLPM.h第167行定义。
int32_t* w_pos [protected] |
在文件SubGradientLPM.h第165行定义。
int32_t* w_zero [protected] |
在文件SubGradientLPM.h第166行定义。
float64_t work_epsilon [protected] |
在文件SubGradientLPM.h第134行定义。
int32_t zero_idx [protected] |
在文件SubGradientLPM.h第164行定义。