shark::QpBoxLinear< InputT > Class Template Reference

Quadratic program solver for box-constrained problems with linear kernel. More...

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

Public Types

typedef LabeledData< InputT, unsigned int > DatasetType
 
typedef LabeledData< InputT, unsigned int >::const_element_reference ElementType
 

Public Member Functions

 QpBoxLinear (const DatasetType &dataset, std::size_t dim)
 Constructor. More...
 
RealVector solve (double bound, double reg, QpStoppingCondition &stop, QpSolutionProperties *prop=NULL, bool verbose=false)
 Solve the SVM training problem. More...
 

Protected Attributes

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...
 

Detailed Description

template<class InputT>
class shark::QpBoxLinear< InputT >

Quadratic program solver for box-constrained problems with linear kernel.

The QpBoxLinear class is a decomposition-based solver for linear support vector machine classifiers trained with the hinge loss. Its optimization is largely based on the paper
"A Dual Coordinate Descent Method for Large-scale Linear SVM" by Hsieh, Chang, and Lin, ICML, 2007. However, the present algorithm differs quite a bit, since it learns variable preferences as a replacement for the missing working set selection. At the same time, this method replaces the shrinking heuristic.

Definition at line 73 of file QpBoxLinear.h.

Member Typedef Documentation

§ DatasetType

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

Definition at line 76 of file QpBoxLinear.h.

§ ElementType

template<class InputT>
typedef LabeledData<InputT, unsigned int>::const_element_reference shark::QpBoxLinear< InputT >::ElementType

Definition at line 77 of file QpBoxLinear.h.

Constructor & Destructor Documentation

§ QpBoxLinear()

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

Constructor.

Parameters
datasettraining data
dimproblem dimension

Definition at line 85 of file QpBoxLinear.h.

References shark::blas::inner_prod(), shark::QpBoxLinear< InputT >::m_data, shark::QpBoxLinear< InputT >::m_xSquared, and SHARK_ASSERT.

Member Function Documentation

§ solve()

template<class InputT>
RealVector shark::QpBoxLinear< InputT >::solve ( double  bound,
double  reg,
QpStoppingCondition stop,
QpSolutionProperties prop = NULL,
bool  verbose = false 
)
inline

Solve the SVM training problem.

Parameters
boundupper bound for alpha-components, complexity parameter of the hinge loss SVM
regcoefficient of the penalty term \(-\frac{reg}{2} \cdot \|\alpha\|^2\), reg=1/C where C is the complexity parameter of the squared hinge loss SVM
stopstopping condition(s)
propsolution properties
verboseif true, the solver prints status information and solution statistics

Definition at line 109 of file QpBoxLinear.h.

References CHANGE_RATE, shark::discrete(), shark::blas::inner_prod(), shark::Timer::lastLap(), shark::QpBoxLinear< InputT >::m_data, shark::QpBoxLinear< InputT >::m_dim, shark::QpBoxLinear< InputT >::m_xSquared, shark::blas::max(), shark::QpStoppingCondition::maxIterations, shark::QpStoppingCondition::maxSeconds, shark::blas::min(), shark::QpStoppingCondition::minAccuracy, PREF_MAX, PREF_MIN, shark::QpAccuracyReached, shark::QpMaxIterationsReached, shark::QpTimeout, SHARK_ASSERT, shark::Timer::start(), shark::Timer::stop(), shark::swap(), shark::uni(), and w.

Referenced by shark::LinearMcSvmOVATrainer< InputType >::train(), shark::LinearCSvmTrainer< InputType >::train(), and shark::SquaredHingeLinearCSvmTrainer< InputType >::train().

Member Data Documentation

§ m_data

template<class InputT>
DataView<const DatasetType> shark::QpBoxLinear< InputT >::m_data
protected

view on training data

Definition at line 312 of file QpBoxLinear.h.

Referenced by shark::QpBoxLinear< InputT >::QpBoxLinear(), and shark::QpBoxLinear< InputT >::solve().

§ m_dim

template<class InputT>
std::size_t shark::QpBoxLinear< InputT >::m_dim
protected

input space dimension

Definition at line 314 of file QpBoxLinear.h.

Referenced by shark::QpBoxLinear< InputT >::solve(), and shark::QpBoxLinear< CompressedRealVector >::solve().

§ m_xSquared

template<class InputT>
RealVector shark::QpBoxLinear< InputT >::m_xSquared
protected

diagonal entries of the quadratic matrix

Definition at line 313 of file QpBoxLinear.h.

Referenced by shark::QpBoxLinear< InputT >::QpBoxLinear(), and shark::QpBoxLinear< InputT >::solve().


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