SHOGUN
v1.1.0
|
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 () |
![]() | |
CLinearMachine () | |
virtual | ~CLinearMachine () |
void | get_w (float64_t *&dst_w, int32_t &dst_dims) |
SGVector< float64_t > | get_w () |
void | set_w (SGVector< float64_t > src_w) |
void | set_bias (float64_t b) |
float64_t | get_bias () |
virtual bool | load (FILE *srcfile) |
virtual bool | save (FILE *dstfile) |
virtual void | set_features (CDotFeatures *feat) |
virtual CLabels * | apply () |
virtual CLabels * | apply (CFeatures *data) |
virtual float64_t | apply (int32_t vec_idx) |
get output for example "vec_idx" | |
virtual CDotFeatures * | get_features () |
![]() | |
CMachine () | |
virtual | ~CMachine () |
virtual bool | train (CFeatures *data=NULL) |
virtual void | set_labels (CLabels *lab) |
virtual CLabels * | get_labels () |
virtual float64_t | get_label (int32_t i) |
void | set_max_train_time (float64_t t) |
float64_t | get_max_train_time () |
void | set_solver_type (ESolverType st) |
ESolverType | get_solver_type () |
virtual void | set_store_model_features (bool store_model) |
![]() | |
CSGObject () | |
CSGObject (const CSGObject &orig) | |
virtual | ~CSGObject () |
virtual bool | is_generic (EPrimitiveType *generic) const |
template<class T > | |
void | set_generic () |
void | unset_generic () |
virtual void | print_serializable (const char *prefix="") |
virtual bool | save_serializable (CSerializableFile *file, const char *prefix="") |
virtual bool | load_serializable (CSerializableFile *file, const char *prefix="") |
void | set_global_io (SGIO *io) |
SGIO * | get_global_io () |
void | set_global_parallel (Parallel *parallel) |
Parallel * | get_global_parallel () |
void | set_global_version (Version *version) |
Version * | get_global_version () |
SGVector< char * > | get_modelsel_names () |
char * | get_modsel_param_descr (const char *param_name) |
index_t | get_modsel_param_index (const char *param_name) |
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) |
![]() | |
virtual void | store_model_features () |
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 |
![]() | |
int32_t | w_dim |
float64_t * | w |
float64_t | bias |
CDotFeatures * | features |
![]() | |
float64_t | max_train_time |
CLabels * | labels |
ESolverType | solver_type |
bool | m_store_model_features |
Additional Inherited Members | |
![]() | |
SGIO * | io |
Parallel * | parallel |
Version * | version |
Parameter * | m_parameters |
Parameter * | m_model_selection_parameters |
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.
|
virtual |
Definition at line 42 of file SubGradientSVM.cpp.
|
protected |
de-alloc helper arrays
Definition at line 493 of file SubGradientSVM.cpp.
|
protected |
compute minimum norm subgradient return norm of minimum norm subgradient
Definition at line 288 of file SubGradientSVM.cpp.
|
protected |
compute svm objective
Definition at line 392 of file SubGradientSVM.cpp.
|
protected |
compute projection
Definition at line 405 of file SubGradientSVM.cpp.
|
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 |
get classifier type
Reimplemented from CMachine.
Definition at line 44 of file SubGradientSVM.h.
float64_t get_epsilon | ( | ) |
|
protectedvirtual |
Reimplemented from CLinearMachine.
Definition at line 150 of file SubGradientSVM.h.
int32_t get_qpsize | ( | ) |
int32_t get_qpsize_max | ( | ) |
|
protected |
alloc helper arrays
Definition at line 416 of file SubGradientSVM.cpp.
|
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 | ) |
|
protectedvirtual |
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.
|
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.
|
protected |
only computes updates on the projection
Definition at line 411 of file SubGradientSVM.cpp.
|
protected |
0=not active, 1=active, 2=on boundary
Definition at line 190 of file SubGradientSVM.h.
|
protected |
autoselected epsilon
Definition at line 173 of file SubGradientSVM.h.
|
protected |
beta
Definition at line 232 of file SubGradientSVM.h.
|
protected |
C1
Definition at line 165 of file SubGradientSVM.h.
|
protected |
C2
Definition at line 167 of file SubGradientSVM.h.
|
protected |
delta active
Definition at line 198 of file SubGradientSVM.h.
|
protected |
delta bound
Definition at line 200 of file SubGradientSVM.h.
|
protected |
epsilon
Definition at line 169 of file SubGradientSVM.h.
|
protected |
grad b
Definition at line 222 of file SubGradientSVM.h.
|
protected |
grad proj
Definition at line 224 of file SubGradientSVM.h.
|
protected |
grad w
Definition at line 220 of file SubGradientSVM.h.
|
protected |
hinge index
Definition at line 228 of file SubGradientSVM.h.
|
protected |
hinge point
Definition at line 226 of file SubGradientSVM.h.
|
protected |
idx active
Definition at line 194 of file SubGradientSVM.h.
|
protected |
idx bound
Definition at line 196 of file SubGradientSVM.h.
|
protected |
last iteration no improvement
Definition at line 184 of file SubGradientSVM.h.
|
protected |
number of iterations no improvement
Definition at line 186 of file SubGradientSVM.h.
|
protected |
old active
Definition at line 192 of file SubGradientSVM.h.
|
protected |
old beta
Definition at line 234 of file SubGradientSVM.h.
|
protected |
old v
Definition at line 214 of file SubGradientSVM.h.
|
protected |
old Z
Definition at line 242 of file SubGradientSVM.h.
|
protected |
old Zv
Definition at line 238 of file SubGradientSVM.h.
|
protected |
proj
Definition at line 202 of file SubGradientSVM.h.
|
protected |
qpsize
Definition at line 175 of file SubGradientSVM.h.
|
protected |
limit of qpsize
Definition at line 179 of file SubGradientSVM.h.
|
protected |
maximum qpsize
Definition at line 177 of file SubGradientSVM.h.
|
protected |
sum CXy active
Definition at line 210 of file SubGradientSVM.h.
|
protected |
sum Cy active
Definition at line 216 of file SubGradientSVM.h.
|
protected |
timing measurement
Definition at line 245 of file SubGradientSVM.h.
|
protected |
tmp proj
Definition at line 204 of file SubGradientSVM.h.
|
protected |
tmp proj index
Definition at line 206 of file SubGradientSVM.h.
|
protected |
shall bias be used
Definition at line 181 of file SubGradientSVM.h.
|
protected |
v
Definition at line 212 of file SubGradientSVM.h.
|
protected |
work epsilon
Definition at line 171 of file SubGradientSVM.h.
|
protected |
Z
Definition at line 240 of file SubGradientSVM.h.
|
protected |
Zv
Definition at line 236 of file SubGradientSVM.h.