shark::QpMcLinearCS< InputT > Class Template Reference

Solver for the multi-class SVM by Crammer & Singer. More...

#include <shark/Algorithms/QP/QpMcLinear.h>

+ Inheritance diagram for shark::QpMcLinearCS< InputT >:

Public Types

typedef LabeledData< InputT, unsigned int > DatasetType
 
- Public Types inherited from shark::QpMcLinear< InputT >
enum  CoordinateSelectionStrategy { UNIFORM, ACF }
 
typedef LabeledData< InputT, unsigned int > DatasetType
 
typedef LabeledData< InputT, unsigned int >::const_element_reference ElementType
 
typedef Batch< InputT >::const_reference InputReferenceType
 

Public Member Functions

 QpMcLinearCS (const DatasetType &dataset, std::size_t dim, std::size_t classes)
 Constructor. More...
 
- Public Member Functions inherited from shark::QpMcLinear< InputT >
 QpMcLinear (const DatasetType &dataset, std::size_t dim, std::size_t classes, std::size_t strategy=ACF, bool shrinking=false)
 Constructor. More...
 
RealMatrix solve (random::rng_type &rng, double C, QpStoppingCondition &stop, QpSolutionProperties *prop=NULL, bool verbose=false)
 Solve the SVM training problem. More...
 

Protected Member Functions

virtual double calcGradient (RealVector &gradient, RealVector wx, blas::matrix_row< RealMatrix > const &alpha, double C, unsigned int y)
 Compute the gradient from the inner products of the weight vectors with the current sample. More...
 
virtual void updateWeightVectors (RealMatrix &w, RealVector const &mu, std::size_t index)
 Update the weight vectors (primal variables) after a step on the dual variables. More...
 
virtual double solveSub (double epsilon, RealVector gradient, double q, double C, unsigned int y, blas::matrix_row< RealMatrix > &alpha, RealVector &mu)
 Solve the sub-problem posed by a single training example. More...
 
- Protected Member Functions inherited from shark::QpMcLinear< InputT >
void add_scaled (RealMatrix &w, RealVector const &mu, InputReferenceType x)
 

Additional Inherited Members

- Protected Attributes inherited from shark::QpMcLinear< InputT >
DataView< const DatasetTypem_data
 view on training data More...
 
RealVector m_xSquared
 diagonal entries of the quadratic matrix More...
 
std::size_t m_dim
 input space dimension More...
 
std::size_t m_classes
 number of classes More...
 
std::size_t m_strategy
 strategy for coordinate selection More...
 
bool m_shrinking
 apply shrinking or not? More...
 

Detailed Description

template<class InputT>
class shark::QpMcLinearCS< InputT >

Solver for the multi-class SVM by Crammer & Singer.

Definition at line 812 of file QpMcLinear.h.

Member Typedef Documentation

◆ DatasetType

template<class InputT >
typedef LabeledData<InputT, unsigned int> shark::QpMcLinearCS< InputT >::DatasetType

Definition at line 815 of file QpMcLinear.h.

Constructor & Destructor Documentation

◆ QpMcLinearCS()

template<class InputT >
shark::QpMcLinearCS< InputT >::QpMcLinearCS ( const DatasetType dataset,
std::size_t  dim,
std::size_t  classes 
)
inline

Constructor.

Definition at line 818 of file QpMcLinear.h.

Member Function Documentation

◆ calcGradient()

template<class InputT >
virtual double shark::QpMcLinearCS< InputT >::calcGradient ( RealVector &  gradient,
RealVector  wx,
blas::matrix_row< RealMatrix > const &  alpha,
double  C,
unsigned int  y 
)
inlineprotectedvirtual

Compute the gradient from the inner products of the weight vectors with the current sample.

Implements shark::QpMcLinear< InputT >.

Definition at line 827 of file QpMcLinear.h.

References shark::QpMcLinear< InputT >::m_classes.

◆ solveSub()

template<class InputT >
virtual double shark::QpMcLinearCS< InputT >::solveSub ( double  epsilon,
RealVector  gradient,
double  q,
double  C,
unsigned int  y,
blas::matrix_row< RealMatrix > &  alpha,
RealVector &  mu 
)
inlineprotectedvirtual

Solve the sub-problem posed by a single training example.

Implements shark::QpMcLinear< InputT >.

Definition at line 882 of file QpMcLinear.h.

References shark::QpMcLinear< InputT >::m_classes.

◆ updateWeightVectors()

template<class InputT >
virtual void shark::QpMcLinearCS< InputT >::updateWeightVectors ( RealMatrix &  w,
RealVector const &  mu,
std::size_t  index 
)
inlineprotectedvirtual

Update the weight vectors (primal variables) after a step on the dual variables.

Implements shark::QpMcLinear< InputT >.

Definition at line 871 of file QpMcLinear.h.

References shark::QpMcLinear< InputT >::add_scaled(), shark::QpMcLinear< InputT >::m_classes, and shark::QpMcLinear< InputT >::m_data.


The documentation for this class was generated from the following file: