shark::QpBoxLinear< CompressedRealVector > Class Template Reference

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

Classes

struct  SparseVector
 Data structure for sparse vectors. More...
 

Public Types

typedef LabeledData< CompressedRealVector, unsigned int > DatasetType
 

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

Static Protected Member Functions

static void axpy (RealVector &w, double alpha, const SparseVector *xi)
 Famous "axpy" product, here adding a multiple of a sparse vector to a dense one. More...
 
static double inner_prod (RealVector const &w, const SparseVector *xi)
 Inner product between a dense and a sparse vector. More...
 

Protected Attributes

std::vector< SparseVector > storage
 storage for sparse vectors More...
 
std::vector< SparseVector * > x
 sparse vectors More...
 
RealVector y
 +1/-1 labels More...
 
RealVector diagonal
 diagonal entries of the quadratic matrix More...
 
std::size_t m_dim
 input space dimension More...
 

Detailed Description

template<>
class shark::QpBoxLinear< CompressedRealVector >

Definition at line 319 of file QpBoxLinear.h.

Member Typedef Documentation

§ DatasetType

typedef LabeledData<CompressedRealVector, unsigned int> shark::QpBoxLinear< CompressedRealVector >::DatasetType

Definition at line 322 of file QpBoxLinear.h.

Constructor & Destructor Documentation

§ QpBoxLinear()

shark::QpBoxLinear< CompressedRealVector >::QpBoxLinear ( const DatasetType dataset,
std::size_t  dim 
)
inline

Constructor.

Parameters
datasettraining data
dimproblem dimension

Definition at line 330 of file QpBoxLinear.h.

References shark::LabeledData< InputT, LabelT >::batch(), shark::get(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), and SHARK_ASSERT.

Member Function Documentation

§ axpy()

static void shark::QpBoxLinear< CompressedRealVector >::axpy ( RealVector &  w,
double  alpha,
const SparseVector *  xi 
)
inlinestaticprotected

Famous "axpy" product, here adding a multiple of a sparse vector to a dense one.

Definition at line 603 of file QpBoxLinear.h.

§ inner_prod()

static double shark::QpBoxLinear< CompressedRealVector >::inner_prod ( RealVector const &  w,
const SparseVector *  xi 
)
inlinestaticprotected

Inner product between a dense and a sparse vector.

Definition at line 614 of file QpBoxLinear.h.

§ solve()

RealVector shark::QpBoxLinear< CompressedRealVector >::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 392 of file QpBoxLinear.h.

References CHANGE_RATE, shark::discrete(), shark::blas::inner_prod(), shark::Timer::lastLap(), shark::QpBoxLinear< InputT >::m_dim, 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.

Member Data Documentation

§ diagonal

RealVector shark::QpBoxLinear< CompressedRealVector >::diagonal
protected

diagonal entries of the quadratic matrix

Definition at line 628 of file QpBoxLinear.h.

§ m_dim

std::size_t shark::QpBoxLinear< CompressedRealVector >::m_dim
protected

input space dimension

Definition at line 629 of file QpBoxLinear.h.

§ storage

std::vector<SparseVector> shark::QpBoxLinear< CompressedRealVector >::storage
protected

storage for sparse vectors

Definition at line 625 of file QpBoxLinear.h.

§ x

std::vector<SparseVector*> shark::QpBoxLinear< CompressedRealVector >::x
protected

sparse vectors

Definition at line 626 of file QpBoxLinear.h.

§ y

RealVector shark::QpBoxLinear< CompressedRealVector >::y
protected

+1/-1 labels

Definition at line 627 of file QpBoxLinear.h.


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