shark::Pegasos< VectorType > Class Template Reference

Pegasos solver for linear (binary) support vector machines. More...

#include <shark/Algorithms/Pegasos.h>

Static Public Member Functions

template<class WeightType >
static std::size_t solve (LabeledData< VectorType, unsigned int > const &data, double C, WeightType &w, std::size_t batchsize=1, double varepsilon=0.001)
 Solve the primal SVM problem. More...
 

Static Protected Member Functions

static bool lg (VectorType const &x, unsigned int y, double f, VectorType &gradient)
 

Detailed Description

template<class VectorType>
class shark::Pegasos< VectorType >

Pegasos solver for linear (binary) support vector machines.

Definition at line 54 of file Pegasos.h.

Member Function Documentation

◆ lg()

template<class VectorType >
static bool shark::Pegasos< VectorType >::lg ( VectorType const &  x,
unsigned int  y,
double  f,
VectorType gradient 
)
inlinestaticprotected

Definition at line 161 of file Pegasos.h.

Referenced by shark::McPegasos< VectorType >::solve().

◆ solve()

template<class VectorType >
template<class WeightType >
static std::size_t shark::Pegasos< VectorType >::solve ( LabeledData< VectorType, unsigned int > const &  data,
double  C,
WeightType &  w,
std::size_t  batchsize = 1,
double  varepsilon = 0.001 
)
inlinestatic

Solve the primal SVM problem.

In addition to "standard" Pegasos this solver checks a meaningful stopping criterion.

The function returns the number of model predictions during training (this is comparable to SMO iterations).

Parameters
datatraining data
CSVM regularization parameter
wweight vector
batchsizenumber of samples in each gradient estimate
varepsilonsolution accuracy (factor by which the primal gradient should be reduced)

Definition at line 65 of file Pegasos.h.

References lambda, shark::LabeledData< InputT, LabelT >::numberOfElements(), SHARK_ASSERT, and w.


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