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

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
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 86 of file SubGradientSVM.h.

float64_t get_C1 (  ) 

get C1


Definition at line 68 of file SubGradientSVM.h.

float64_t get_C2 (  ) 

get C2


Definition at line 74 of file SubGradientSVM.h.

virtual EClassifierType get_classifier_type (  )  [virtual]

get classifier type

classifier type SUBGRADIENTSVM

Reimplemented from CClassifier.

Definition at line 44 of file SubGradientSVM.h.

float64_t get_epsilon (  ) 

get epsilon


Definition at line 98 of file SubGradientSVM.h.

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

Reimplemented from CLinearClassifier.

Definition at line 160 of file SubGradientSVM.h.

int32_t get_qpsize (  ) 

get qpsize


Definition at line 110 of file SubGradientSVM.h.

int32_t get_qpsize_max (  ) 

get qpsize_max


Definition at line 122 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 80 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 61 of file SubGradientSVM.h.

void set_epsilon ( float64_t  eps  ) 

set epsilon

eps new epsilon

Definition at line 92 of file SubGradientSVM.h.

void set_qpsize ( int32_t  q  ) 

set qpsize

q new qpsize

Definition at line 104 of file SubGradientSVM.h.

void set_qpsize_max ( int32_t  q  ) 

set qpsize_max

q new qpsize_max

Definition at line 116 of file SubGradientSVM.h.

bool train ( CFeatures data = NULL  )  [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 CClassifier.

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 189 of file SubGradientSVM.h.

autoselected epsilon

Definition at line 172 of file SubGradientSVM.h.

float64_t* beta [protected]


Definition at line 231 of file SubGradientSVM.h.

float64_t C1 [protected]


Definition at line 164 of file SubGradientSVM.h.

float64_t C2 [protected]


Definition at line 166 of file SubGradientSVM.h.

int32_t delta_active [protected]

delta active

Definition at line 197 of file SubGradientSVM.h.

int32_t delta_bound [protected]

delta bound

Definition at line 199 of file SubGradientSVM.h.

float64_t epsilon [protected]


Definition at line 168 of file SubGradientSVM.h.

float64_t grad_b [protected]

grad b

Definition at line 221 of file SubGradientSVM.h.

float64_t* grad_proj [protected]

grad proj

Definition at line 223 of file SubGradientSVM.h.

float64_t* grad_w [protected]

grad w

Definition at line 219 of file SubGradientSVM.h.

int32_t* hinge_idx [protected]

hinge index

Definition at line 227 of file SubGradientSVM.h.

float64_t* hinge_point [protected]

hinge point

Definition at line 225 of file SubGradientSVM.h.

int32_t* idx_active [protected]

idx active

Definition at line 193 of file SubGradientSVM.h.

int32_t* idx_bound [protected]

idx bound

Definition at line 195 of file SubGradientSVM.h.

int32_t last_it_noimprovement [protected]

last iteration no improvement

Definition at line 183 of file SubGradientSVM.h.

int32_t num_it_noimprovement [protected]

number of iterations no improvement

Definition at line 185 of file SubGradientSVM.h.

uint8_t* old_active [protected]

old active

Definition at line 191 of file SubGradientSVM.h.

float64_t* old_beta [protected]

old beta

Definition at line 233 of file SubGradientSVM.h.

float64_t* old_v [protected]

old v

Definition at line 213 of file SubGradientSVM.h.

float64_t* old_Z [protected]

old Z

Definition at line 241 of file SubGradientSVM.h.

float64_t* old_Zv [protected]

old Zv

Definition at line 237 of file SubGradientSVM.h.

float64_t* proj [protected]


Definition at line 201 of file SubGradientSVM.h.

int32_t qpsize [protected]


Definition at line 174 of file SubGradientSVM.h.

int32_t qpsize_limit [protected]

limit of qpsize

Definition at line 178 of file SubGradientSVM.h.

int32_t qpsize_max [protected]

maximum qpsize

Definition at line 176 of file SubGradientSVM.h.

float64_t* sum_CXy_active [protected]

sum CXy active

Definition at line 209 of file SubGradientSVM.h.

float64_t sum_Cy_active [protected]

sum Cy active

Definition at line 215 of file SubGradientSVM.h.

float64_t tim [protected]

timing measurement

Definition at line 244 of file SubGradientSVM.h.

float64_t* tmp_proj [protected]

tmp proj

Definition at line 203 of file SubGradientSVM.h.

int32_t* tmp_proj_idx [protected]

tmp proj index

Definition at line 205 of file SubGradientSVM.h.

bool use_bias [protected]

shall bias be used

Definition at line 180 of file SubGradientSVM.h.

float64_t* v [protected]


Definition at line 211 of file SubGradientSVM.h.

float64_t work_epsilon [protected]

work epsilon

Definition at line 170 of file SubGradientSVM.h.

float64_t* Z [protected]


Definition at line 239 of file SubGradientSVM.h.

float64_t* Zv [protected]


Definition at line 235 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