Documentation - C API
pegasos.h File Reference

PEGASOS (PEGASOS SVM solver) More...

#include "generic.h"

Functions

void vl_pegasos_train_binary_svm_d (double *model, double const *data, vl_size dimension, vl_size numSamples, vl_int8 const *labels, double regularizer, double biasMultiplier, vl_uindex startingIteration, vl_size numIterations, VlRand *randomGenerator, vl_uint32 const *permutation, vl_size permutationSize, double const *preconditioner)
void vl_pegasos_train_binary_svm_f (float *model, float const *data, vl_size dimension, vl_size numSamples, vl_int8 const *labels, double regularizer, double biasMultiplier, vl_uindex startingIteration, vl_size numIterations, VlRand *randomGenerator, vl_uint32 const *permutation, vl_size permutationSize, float const *preconditioner)

Detailed Description

Author:
Andrea Vedaldi

Function Documentation

vl_pegasos_train_binary_svm_d ( double *  model,
double const *  data,
vl_size  dimension,
vl_size  numSamples,
vl_int8 const *  labels,
double  regularizer,
double  biasMultiplier,
vl_uindex  startingIteration,
vl_size  numIterations,
VlRand randomGenerator,
vl_uint32 const *  permutation,
vl_size  permutationSize,
double const *  preconditioner 
)
Parameters:
model(out) the learned model.
datatraining vectors.
dimensiondata dimension.
numSamplesnumber of training data vectors.
labelslabels of the training vectors.
regularizervalue of the regularizer coefficient $ \lambda $.
biasMultipliervalue of the bias multiplier $ B $.
startingIterationnumber of the first iteration.
numIterationsnumber of iterations to perform.
randomGeneratorrandom number generator.
permutationorder in which the data is accessed.
permutationSizelength of permutation.
preconditionerdiagonal precoditioner.

The function runs PEGASOS on the specified data. The vector model must have either dimension equal to dimension if biasMultiplier is zero, or dimension + 1 if biasMultiplier is larger than zero.

The function runs PEGASOS for iterations t in the interval [fistIteration, lastIteration]. Together with the fact that the initial model can be set arbitrarily, this enable restarting PEGASOS from any point.

PEGASOS select the next point for computing the gradient at random. If randomGenerator is NULL, the default random generator (as returned by vl_get_rand()) is used.

Alternatively, if permutation is not NULL, then points are sampled in the order specified by this vector of indexes (this is cycled through). In this way It is an error to set both randomGenerator and permutation to non-null values.

preconditioner specifies a diagonal preconditioner for the minimization problem (it is often useful to slow down the steps for the bias term, if the latter is used). Set preconditioner to NULL to avoid using a preconditioner. The precodnitioner should have the same dimension of the model, plus one if an SVM with bias is learned.

See the Overview overview for details.

vl_pegasos_train_binary_svm_f ( float *  model,
float const *  data,
vl_size  dimension,
vl_size  numSamples,
vl_int8 const *  labels,
double  regularizer,
double  biasMultiplier,
vl_uindex  startingIteration,
vl_size  numIterations,
VlRand randomGenerator,
vl_uint32 const *  permutation,
vl_size  permutationSize,
float const *  preconditioner 
)