MKLMultiClassGradient is a helper class for MKLMultiClass.
it solves the corresponding linear problem arising in SIP formulation for MKL using a gradient based approach
Definition at line 28 of file MKLMultiClassGradient.h.
Public Member Functions | |
MKLMultiClassGradient () | |
virtual | ~MKLMultiClassGradient () |
MKLMultiClassGradient (MKLMultiClassGradient &gl) | |
MKLMultiClassGradient | operator= (MKLMultiClassGradient &gl) |
virtual void | setup (const int32_t numkernels2) |
virtual void | addconstraint (const ::std::vector< float64_t > &normw2, const float64_t sumofpositivealphas) |
virtual void | computeweights (std::vector< float64_t > &weights2) |
virtual const char * | get_name () const |
virtual void | set_mkl_norm (float64_t norm) |
Protected Member Functions | |
void | genbetas (::std::vector< float64_t > &weights, const ::std::vector< float64_t > &gammas) |
void | gengammagradient (::std::vector< float64_t > &gammagradient, const ::std::vector< float64_t > &gammas, const int32_t dim) |
float64_t | objectives (const ::std::vector< float64_t > &weights, const int32_t index) |
void | linesearch (std::vector< float64_t > &finalbeta, const std::vector< float64_t > &oldweights) |
Protected Attributes | |
int32_t | numkernels |
::std::vector< ::std::vector < float64_t > > | normsofsubkernels |
::std::vector< float64_t > | sumsofalphas |
float64_t | pnorm |
Class default Constructor
Definition at line 15 of file MKLMultiClassGradient.cpp.
~MKLMultiClassGradient | ( | ) | [virtual] |
Class default Destructor
Definition at line 21 of file MKLMultiClassGradient.cpp.
Class Copy Constructor
Definition at line 33 of file MKLMultiClassGradient.cpp.
void addconstraint | ( | const ::std::vector< float64_t > & | normw2, | |
const float64_t | sumofpositivealphas | |||
) | [virtual] |
adds a constraint to the LP arising in L1 MKL based on two parameters
normw2 | is the vector of ![]() | |
sumofpositivealphas | is a term depending on alphas, labels and biases, see in the function float64_t getsumofsignfreealphas() from MKLMultiClass.h, it depends on the formulation of the underlying GMNPSVM. |
Reimplemented from MKLMultiClassOptimizationBase.
Definition at line 60 of file MKLMultiClassGradient.cpp.
void computeweights | ( | std::vector< float64_t > & | weights2 | ) | [virtual] |
computes MKL weights
weights2 | stores the new weights |
Reimplemented from MKLMultiClassOptimizationBase.
Definition at line 355 of file MKLMultiClassGradient.cpp.
void genbetas | ( | ::std::vector< float64_t > & | weights, | |
const ::std::vector< float64_t > & | gammas | |||
) | [protected] |
helper routine for MKL optimization, computes form manifold coordinates the point on the manifold
gammas | - manifold coordinates | |
weights | - the point on the manifold |
Definition at line 67 of file MKLMultiClassGradient.cpp.
void gengammagradient | ( | ::std::vector< float64_t > & | gammagradient, | |
const ::std::vector< float64_t > & | gammas, | |||
const int32_t | dim | |||
) | [protected] |
helper routine for MKL optimization, computes greadient of manifold parametrization for one coordinate
gammagradient | - gradient | |
gammas | - manifold coordinates | |
dim | - the coordinate for which thegradient is to be computed |
Definition at line 98 of file MKLMultiClassGradient.cpp.
virtual const char* get_name | ( | void | ) | const [virtual] |
Reimplemented from MKLMultiClassOptimizationBase.
Definition at line 77 of file MKLMultiClassGradient.h.
void linesearch | ( | std::vector< float64_t > & | finalbeta, | |
const std::vector< float64_t > & | oldweights | |||
) | [protected] |
helper routine for MKL optimization, performs linesearch
finalbeta | ||
oldweights |
Definition at line 154 of file MKLMultiClassGradient.cpp.
float64_t objectives | ( | const ::std::vector< float64_t > & | weights, | |
const int32_t | index | |||
) | [protected] |
helper routine for MKL optimization, computes optimization objective for one contraint
weights | - MKL weights | |
index | - index of constraint |
Definition at line 138 of file MKLMultiClassGradient.cpp.
MKLMultiClassGradient operator= | ( | MKLMultiClassGradient & | gl | ) |
Class Assignment operator
Definition at line 26 of file MKLMultiClassGradient.cpp.
void set_mkl_norm | ( | float64_t | norm | ) | [virtual] |
sets p-norm parameter for MKL
norm | the MKL norm |
Reimplemented from MKLMultiClassOptimizationBase.
Definition at line 52 of file MKLMultiClassGradient.cpp.
void setup | ( | const int32_t | numkernels2 | ) | [virtual] |
initializes solver
numkernels2 | is the number of kernels |
Reimplemented from MKLMultiClassOptimizationBase.
Definition at line 40 of file MKLMultiClassGradient.cpp.
::std::vector< ::std::vector<float64_t> > normsofsubkernels [protected] |
stores normsofsubkernels which is a constraint, normsofsubkernels[i] belongs to the i-th constraint
Definition at line 125 of file MKLMultiClassGradient.h.
int32_t numkernels [protected] |
stores the number of kernels which acts as a parameter for the LP
Definition at line 122 of file MKLMultiClassGradient.h.
stores the L^p norm which acts as a parameter for the LP
Definition at line 129 of file MKLMultiClassGradient.h.
::std::vector< float64_t > sumsofalphas [protected] |
stores the bias type term of constraints, sumsofalphas[i] belongs to the i-th constraint
Definition at line 127 of file MKLMultiClassGradient.h.