Public Member Functions | Protected Member Functions | Protected Attributes

CSubGradientSVM Class Reference

Detailed Description

class SubGradientSVM

Definition at line 23 of file SubGradientSVM.h.

Inheritance diagram for CSubGradientSVM:
Inheritance graph

List of all members.

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
int32_t * tmp_proj_idx
float64_t sum_Cy_active
float64_t grad_b
int32_t * hinge_idx
float64_t tim

Constructor & Destructor Documentation

CSubGradientSVM (  ) 

default constructor

Definition at line 26 of file SubGradientSVM.cpp.

CSubGradientSVM ( float64_t  C,
CDotFeatures traindat,
CLabels trainlab 


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.

Member Function Documentation

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 (  ) 

check if bias is enabled

if bias is enabled

Definition at line 76 of file SubGradientSVM.h.

float64_t get_C1 (  ) 

get C1


Definition at line 58 of file SubGradientSVM.h.

float64_t get_C2 (  ) 

get C2


Definition at line 64 of file SubGradientSVM.h.

virtual EClassifierType get_classifier_type (  )  [virtual]

get classifier type

classifier type SUBGRADIENTSVM

Reimplemented from CMachine.

Definition at line 44 of file SubGradientSVM.h.

float64_t get_epsilon (  ) 

get epsilon


Definition at line 88 of file SubGradientSVM.h.

virtual const char* get_name (  )  const [protected, virtual]
object name

Reimplemented from CLinearMachine.

Definition at line 150 of file SubGradientSVM.h.

int32_t get_qpsize (  ) 

get qpsize


Definition at line 100 of file SubGradientSVM.h.

int32_t get_qpsize_max (  ) 

get qpsize_max


Definition at line 112 of file SubGradientSVM.h.

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_C ( float64_t  c_neg,
float64_t  c_pos 

set C

c_neg C1
c_pos C2

Definition at line 51 of file SubGradientSVM.h.

void set_epsilon ( float64_t  eps  ) 

set epsilon

eps new epsilon

Definition at line 82 of file SubGradientSVM.h.

void set_qpsize ( int32_t  q  ) 

set qpsize

q new qpsize

Definition at line 94 of file SubGradientSVM.h.

void set_qpsize_max ( int32_t  q  ) 

set qpsize_max

q new qpsize_max

Definition at line 106 of file SubGradientSVM.h.

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)
whether training was successful

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.

Member Data Documentation

uint8_t* active [protected]

0=not active, 1=active, 2=on boundary

Definition at line 190 of file SubGradientSVM.h.

autoselected epsilon

Definition at line 173 of file SubGradientSVM.h.

float64_t* beta [protected]


Definition at line 232 of file SubGradientSVM.h.

float64_t C1 [protected]


Definition at line 165 of file SubGradientSVM.h.

float64_t C2 [protected]


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.

float64_t epsilon [protected]


Definition at line 169 of file SubGradientSVM.h.

float64_t grad_b [protected]

grad b

Definition at line 222 of file SubGradientSVM.h.

float64_t* grad_proj [protected]

grad proj

Definition at line 224 of file SubGradientSVM.h.

float64_t* grad_w [protected]

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.

float64_t* old_beta [protected]

old beta

Definition at line 234 of file SubGradientSVM.h.

float64_t* old_v [protected]

old v

Definition at line 214 of file SubGradientSVM.h.

float64_t* old_Z [protected]

old Z

Definition at line 242 of file SubGradientSVM.h.

float64_t* old_Zv [protected]

old Zv

Definition at line 238 of file SubGradientSVM.h.

float64_t* proj [protected]


Definition at line 202 of file SubGradientSVM.h.

int32_t qpsize [protected]


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.

float64_t tim [protected]

timing measurement

Definition at line 245 of file SubGradientSVM.h.

float64_t* tmp_proj [protected]

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.

float64_t* v [protected]


Definition at line 212 of file SubGradientSVM.h.

float64_t work_epsilon [protected]

work epsilon

Definition at line 171 of file SubGradientSVM.h.

float64_t* Z [protected]


Definition at line 240 of file SubGradientSVM.h.

float64_t* Zv [protected]


Definition at line 236 of file SubGradientSVM.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation