Public Member Functions | Protected Member Functions | Protected Attributes

CMKLMultiClass Class Reference

Detailed Description

MKLMultiClass is a class for L1-norm multiclass MKL.

It is based on the GMNPSVM Multiclass SVM. Its own parameters are the L2 norm weight change based MKL Its termination criterion set by void set_mkl_epsilon(float64_t eps ); and the maximal number of MKL iterations set by void set_max_num_mkliters(int32_t maxnum); It passes the regularization constants C1 and C2 to GMNPSVM.

Definition at line 32 of file MKLMultiClass.h.

Inheritance diagram for CMKLMultiClass:
Inheritance graph

List of all members.

Public Member Functions

 CMKLMultiClass ()
 CMKLMultiClass (float64_t C, CKernel *k, CLabels *lab)
virtual ~CMKLMultiClass ()
virtual bool train (CFeatures *data=NULL)
virtual EClassifierType get_classifier_type ()
float64_tgetsubkernelweights (int32_t &numweights)
void set_mkl_epsilon (float64_t eps)
void set_max_num_mkliters (int32_t maxnum)
virtual void set_mkl_norm (float64_t norm)

Protected Member Functions

 CMKLMultiClass (const CMKLMultiClass &cm)
CMKLMultiClass operator= (const CMKLMultiClass &cm)
void initlpsolver ()
void initsvm ()
virtual bool evaluatefinishcriterion (const int32_t numberofsilpiterations)
void addingweightsstep (const std::vector< float64_t > &curweights)
float64_t getsumofsignfreealphas ()
float64_t getsquarenormofprimalcoefficients (const int32_t ind)

Protected Attributes

::std::vector< std::vector
< float64_t > > 
float64_t mkl_eps
int32_t max_num_mkl_iters
float64_t pnorm
std::vector< float64_tnormweightssquared

Constructor & Destructor Documentation

CMKLMultiClass (  ) 

Class default Constructor

Definition at line 17 of file MKLMultiClass.cpp.

CMKLMultiClass ( float64_t  C,
CKernel k,
CLabels lab 

Class Constructor commonly used in Shogun Toolbox

C constant C
k kernel
lab labels

Definition at line 28 of file MKLMultiClass.cpp.

~CMKLMultiClass (  )  [virtual]

Class default Destructor

Definition at line 40 of file MKLMultiClass.cpp.

CMKLMultiClass ( const CMKLMultiClass cm  )  [protected]

Class Copy Constructor protected to avoid its usage

Definition at line 48 of file MKLMultiClass.cpp.

Member Function Documentation

void addingweightsstep ( const std::vector< float64_t > &  curweights  )  [protected]

adds a constraint to the LP used in MKL

curweights are the current MKL weights

it uses void addingweightsstep( const std::vector<float64_t> & curweights); and float64_t getsumofsignfreealphas();

Definition at line 214 of file MKLMultiClass.cpp.

bool evaluatefinishcriterion ( const int32_t  numberofsilpiterations  )  [protected, virtual]

checks MKL for convergence

numberofsilpiterations is the number of currently done iterations

Definition at line 138 of file MKLMultiClass.cpp.

virtual EClassifierType get_classifier_type (  )  [virtual]

get classifier type

classifier type GMNPMKL

Reimplemented from CClassifier.

Definition at line 66 of file MKLMultiClass.h.

float64_t getsquarenormofprimalcoefficients ( const int32_t  ind  )  [protected]

computes the second svm-dependent part used for generating MKL constraints

ind is the index of the kernel for which to compute $ \|w \|^2 $

Definition at line 301 of file MKLMultiClass.cpp.

float64_t * getsubkernelweights ( int32_t &  numweights  ) 

returns MKL weights for the different kernels

numweights is output parameter, is set to zero if no weights have been computed or to the number of MKL weights which is equal to the number of kernels
NULL if no weights have been computed or otherwise an array with the weights, caller has to delete[] the output by itself

Definition at line 415 of file MKLMultiClass.cpp.

float64_t getsumofsignfreealphas (  )  [protected]

computes the first svm-dependent part used for generating MKL constraints it is $ \sum_y b_y^2-\sum_i \sum_{ y | y \neq y_i} \alpha_{iy}(b_{y_i}-b_y-1) $

Definition at line 250 of file MKLMultiClass.cpp.

void initlpsolver (  )  [protected]

performs some sanity checks (on the provided kernel), inits the GLPK-based LP solver

Definition at line 99 of file MKLMultiClass.cpp.

void initsvm (  )  [protected]

inits the underlying Multiclass SVM

Definition at line 67 of file MKLMultiClass.cpp.

CMKLMultiClass operator= ( const CMKLMultiClass cm  )  [protected]

Class Assignment operator protected to avoid its usage

Definition at line 58 of file MKLMultiClass.cpp.

void set_max_num_mkliters ( int32_t  maxnum  ) 

sets maximal number of MKL iterations

maxnum is the desired maximal number of MKL iterations; when it is reached the MKL terminates irrespective of the MKL progress set it to a nonpositive value in order to turn it off

Definition at line 436 of file MKLMultiClass.cpp.

void set_mkl_epsilon ( float64_t  eps  ) 

sets MKL termination threshold

eps is the desired threshold value the termination criterion is the L2 norm between the current MKL weights and their counterpart from the previous iteration

Definition at line 431 of file MKLMultiClass.cpp.

void set_mkl_norm ( float64_t  norm  )  [virtual]

Definition at line 441 of file MKLMultiClass.cpp.

bool train ( CFeatures data = NULL  )  [virtual]

train Multiclass MKL 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 337 of file MKLMultiClass.cpp.

Member Data Documentation

the solver wrapper

Definition at line 172 of file MKLMultiClass.h.

int32_t max_num_mkl_iters [protected]

maximal number of MKL iterations is set by void set_max_num_mkliters(int32_t maxnum);

Definition at line 185 of file MKLMultiClass.h.

float64_t mkl_eps [protected]

MKL termination threshold is set void set_mkl_epsilon(float64_t eps );

Definition at line 181 of file MKLMultiClass.h.

std::vector<float64_t> normweightssquared [protected]

stores the term \| w_l \|^2 ~~~ "alpha o Y K_l Y o alpha"

Definition at line 193 of file MKLMultiClass.h.

float64_t pnorm [protected]

MKL norm >=1

Definition at line 189 of file MKLMultiClass.h.

CGMNPSVM* svm [protected]

the multiclass svm for fixed MKL weights

Definition at line 168 of file MKLMultiClass.h.

::std::vector< std::vector< float64_t> > weightshistory [protected]

stores the last two mkl iteration weights

Definition at line 176 of file MKLMultiClass.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