Pegasos solver for linear multi-class support vector machines. More...
#include <shark/Algorithms/Pegasos.h>
Public Types | |
enum | eMarginType { emRelative , emAbsolute } |
Multi-class margin type. More... | |
enum | eLossType { elNaiveHinge , elDiscriminativeMax , elDiscriminativeSum , elTotalMax , elTotalSum } |
Multi-class loss function type. More... | |
Static Public Member Functions | |
template<class WeightType > | |
static std::size_t | solve (LabeledData< VectorType, unsigned int > const &data, eMarginType margintype, eLossType losstype, bool sumToZero, double C, std::vector< WeightType > &w, std::size_t batchsize=1, double varepsilon=0.001) |
Solve the primal multi-class SVM problem. | |
Protected Types | |
typedef bool(* | LossGradientFunction) (VectorType const &, unsigned int, RealVector const &, std::vector< VectorType > &, bool) |
Static Protected Member Functions | |
static bool | lossGradientANH (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
static bool | lossGradientRDM (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
static bool | lossGradientRDS (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
static bool | lossGradientADS (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
static bool | lossGradientADM (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
static bool | lossGradientATS (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
static bool | lossGradientATM (VectorType const &x, unsigned int y, RealVector const &f, std::vector< VectorType > &gradient, bool sumToZero) |
Pegasos solver for linear multi-class support vector machines.
|
protected |
enum shark::McPegasos::eLossType |
enum shark::McPegasos::eMarginType |
|
inlinestaticprotected |
Definition at line 483 of file Pegasos.h.
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestaticprotected |
Definition at line 456 of file Pegasos.h.
References shark::mean().
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestaticprotected |
Definition at line 387 of file Pegasos.h.
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestaticprotected |
Definition at line 553 of file Pegasos.h.
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestaticprotected |
Definition at line 515 of file Pegasos.h.
References shark::mean().
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestaticprotected |
Definition at line 408 of file Pegasos.h.
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestaticprotected |
Definition at line 435 of file Pegasos.h.
Referenced by shark::McPegasos< VectorType >::solve().
|
inlinestatic |
Solve the primal multi-class 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).
data | training data |
margintype | margin function type |
losstype | loss function type |
sumToZero | enforce the sum-to-zero constraint? |
C | SVM regularization parameter |
w | class-wise weight vectors |
batchsize | number of samples in each gradient estimate |
varepsilon | solution accuracy (factor by which the primal gradient should be reduced) |
Definition at line 220 of file Pegasos.h.
References shark::random::discrete(), shark::McPegasos< VectorType >::elDiscriminativeMax, shark::McPegasos< VectorType >::elDiscriminativeSum, shark::McPegasos< VectorType >::elNaiveHinge, shark::McPegasos< VectorType >::elTotalMax, shark::McPegasos< VectorType >::elTotalSum, shark::McPegasos< VectorType >::emAbsolute, shark::McPegasos< VectorType >::emRelative, shark::McPegasos< VectorType >::lossGradientADM(), shark::McPegasos< VectorType >::lossGradientADS(), shark::McPegasos< VectorType >::lossGradientANH(), shark::McPegasos< VectorType >::lossGradientATM(), shark::McPegasos< VectorType >::lossGradientATS(), shark::McPegasos< VectorType >::lossGradientRDM(), shark::McPegasos< VectorType >::lossGradientRDS(), shark::LabeledData< InputT, LabelT >::numberOfElements(), SHARK_ASSERT, and SHARK_RUNTIME_CHECK.