#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... | |
Definition at line 319 of file QpBoxLinear.h.
typedef LabeledData<CompressedRealVector, unsigned int> shark::QpBoxLinear< CompressedRealVector >::DatasetType |
Definition at line 322 of file QpBoxLinear.h.
|
inline |
Constructor.
dataset | training data |
dim | problem 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.
|
inlinestaticprotected |
Famous "axpy" product, here adding a multiple of a sparse vector to a dense one.
Definition at line 603 of file QpBoxLinear.h.
|
inlinestaticprotected |
Inner product between a dense and a sparse vector.
Definition at line 614 of file QpBoxLinear.h.
|
inline |
Solve the SVM training problem.
bound | upper bound for alpha-components, complexity parameter of the hinge loss SVM |
reg | coefficient 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 |
stop | stopping condition(s) |
prop | solution properties |
verbose | if 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.
|
protected |
diagonal entries of the quadratic matrix
Definition at line 628 of file QpBoxLinear.h.
|
protected |
input space dimension
Definition at line 629 of file QpBoxLinear.h.
|
protected |
storage for sparse vectors
Definition at line 625 of file QpBoxLinear.h.
|
protected |
sparse vectors
Definition at line 626 of file QpBoxLinear.h.
|
protected |
+1/-1 labels
Definition at line 627 of file QpBoxLinear.h.