Classes | Typedefs | Enumerations
svm.h File Reference

Support Vector Machines (Support Vector Machines (SVM)) More...

#include "generic.h"
#include "svmdataset.h"
Include dependency graph for svm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  VlSvmStatistics_
 SVM statistics This structure contains statistics characterising the state of the SVM solver, such as the current value of the objective function. More...

Typedefs

typedef struct VlSvm_ VlSvm
 SVM solver. This object implements VLFeat SVM solvers (see svm.h).
typedef struct VlSvmStatistics_ VlSvmStatistics
 SVM statistics This structure contains statistics characterising the state of the SVM solver, such as the current value of the objective function.

Enumerations

enum  VlSvmLossType {
  VlSvmLossHinge = 0, VlSvmLossHinge2 = 1, VlSvmLossL1, VlSvmLossL2,
  VlSvmLossLogistic
}
 Type of SVM loss. More...
enum  VlSvmSolverStatus { VlSvmStatusTraining = 1, VlSvmStatusConverged, VlSvmStatusMaxNumIterationsReached }
 Solver status. More...
enum  VlSvmSolverType { VlSvmSolverNone = 0, VlSvmSolverSgd = 1, VlSvmSolverSdca }
 Type of SVM solver. More...

Functions

Create and destroy
VL_EXPORT VlSvmvl_svm_new (VlSvmSolverType type, double const *data, vl_size dimension, vl_size numData, double const *labels, double lambda)
 Create a new object with plain data.
VL_EXPORT VlSvmvl_svm_new_with_dataset (VlSvmSolverType type, VlSvmDataset *dataset, double const *labels, double lambda)
 Create a new object with a dataset.
VL_EXPORT VlSvmvl_svm_new_with_abstract_data (VlSvmSolverType type, void *data, vl_size dimension, vl_size numData, double const *labels, double lambda)
 Create a new object with abstract data.
VL_EXPORT void vl_svm_delete (VlSvm *self)
 Delete object.
Retrieve parameters and data
VL_EXPORT VlSvmStatistics const * vl_svm_get_statistics (VlSvm const *self)
 Get the solver statistics.
VL_EXPORT double const * vl_svm_get_model (VlSvm const *self)
 Get the SVM model.
VL_EXPORT double vl_svm_get_bias (VlSvm const *self)
 Get the value of the bias.
VL_EXPORT vl_size vl_svm_get_dimension (VlSvm *self)
 Get the model dimenison.
VL_EXPORT vl_size vl_svm_get_num_data (VlSvm *self)
 Get the number of data samples.
VL_EXPORT double vl_svm_get_epsilon (VlSvm const *self)
 Get the convergence threshold.
VL_EXPORT double vl_svm_get_bias_learning_rate (VlSvm const *self)
 Get the bias leraning rate.
VL_EXPORT vl_size vl_svm_get_max_num_iterations (VlSvm const *self)
 Get the maximum number of iterations.
VL_EXPORT vl_size vl_svm_get_diagnostic_frequency (VlSvm const *self)
 Get the diagnostic frequency.
VL_EXPORT VlSvmSolverType vl_svm_get_solver (VlSvm const *self)
 Get the SVM solver type.
VL_EXPORT double vl_svm_get_bias_multiplier (VlSvm const *self)
 Get the bias multiplier.
VL_EXPORT double vl_svm_get_lambda (VlSvm const *self)
 Get the regularizer parameter lambda.
VL_EXPORT vl_size vl_svm_get_iteration_number (VlSvm const *self)
 Get the current iteration number.
VL_EXPORT double const * vl_svm_get_scores (VlSvm const *self)
 Get the scores of the data points.
VL_EXPORT double const * vl_svm_get_weights (VlSvm const *self)
 Get the data weights.
Set parameters
VL_EXPORT void vl_svm_set_epsilon (VlSvm *self, double epsilon)
 Set the convergence threshold.
VL_EXPORT void vl_svm_set_bias_learning_rate (VlSvm *self, double rate)
 Set the bias learning rate.
VL_EXPORT void vl_svm_set_max_num_iterations (VlSvm *self, vl_size maxNumIterations)
 Set the maximum number of iterations.
VL_EXPORT void vl_svm_set_diagnostic_frequency (VlSvm *self, vl_size f)
 Set the diagnostic frequency.
VL_EXPORT void vl_svm_set_bias_multiplier (VlSvm *self, double b)
 Set the bias multiplier.
VL_EXPORT void vl_svm_set_model (VlSvm *self, double const *model)
 Set the SVM model.
VL_EXPORT void vl_svm_set_bias (VlSvm *self, double b)
 Set the SVM bias.
VL_EXPORT void vl_svm_set_iteration_number (VlSvm *self, vl_uindex n)
 Set the current iteratio number.
VL_EXPORT void vl_svm_set_weights (VlSvm *self, double const *weights)
 Set the data weights.
VL_EXPORT void vl_svm_set_diagnostic_function (VlSvm *self, VlSvmDiagnosticFunction f, void *data)
 Set the diagnostic function callback.
VL_EXPORT void vl_svm_set_loss_function (VlSvm *self, VlSvmLossFunction f)
 Set the loss function callback.
VL_EXPORT void vl_svm_set_loss_derivative_function (VlSvm *self, VlSvmLossFunction f)
 Set the loss derivative function callback.
VL_EXPORT void vl_svm_set_conjugate_loss_function (VlSvm *self, VlSvmLossFunction f)
 Set the conjugate loss function callback.
VL_EXPORT void vl_svm_set_dca_update_function (VlSvm *self, VlSvmDcaUpdateFunction f)
 Set the DCA update function callback.
VL_EXPORT void vl_svm_set_data_functions (VlSvm *self, VlSvmInnerProductFunction inner, VlSvmAccumulateFunction acc)
 Set the data functions.
VL_EXPORT void vl_svm_set_loss (VlSvm *self, VlSvmLossType loss)
 Set the loss function to one of the default types.
Process data
VL_EXPORT void vl_svm_train (VlSvm *self)
 Run the SVM solver.
Loss functions
VL_EXPORT double vl_svm_hinge_loss (double label, double inner)
 SVM hinge loss.
VL_EXPORT double vl_svm_hinge_loss_derivative (double label, double inner)
 SVM hinge loss derivative.
VL_EXPORT double vl_svm_hinge_conjugate_loss (double label, double u)
 SVM hinge loss conjugate.
VL_EXPORT double vl_svm_hinge_dca_update (double alpha, double inner, double norm2, double label)
 SVM hinge loss DCA update.
VL_EXPORT double vl_svm_hinge2_loss (double label, double inner)
 SVM square hinge loss.
VL_EXPORT double vl_svm_hinge2_loss_derivative (double label, double inner)
 SVM square hinge loss derivative.
VL_EXPORT double vl_svm_hinge2_conjugate_loss (double label, double u)
 SVM square hinge loss conjugate.
VL_EXPORT double vl_svm_hinge2_dca_update (double alpha, double inner, double norm2, double label)
 SVM square hinge loss DCA update.
VL_EXPORT double vl_svm_l1_loss (double label, double inner)
 SVM l1 loss.
VL_EXPORT double vl_svm_l1_loss_derivative (double label, double inner)
 SVM l1 loss derivative.
VL_EXPORT double vl_svm_l1_conjugate_loss (double label, double u)
 SVM l1 loss conjugate.
VL_EXPORT double vl_svm_l1_dca_update (double alpha, double inner, double norm2, double label)
 SVM l1 loss DCA update.
VL_EXPORT double vl_svm_l2_loss (double label, double inner)
 SVM l2 loss.
VL_EXPORT double vl_svm_l2_loss_derivative (double label, double inner)
 SVM l2 loss derivative.
VL_EXPORT double vl_svm_l2_conjugate_loss (double label, double u)
 SVM l2 loss conjugate.
VL_EXPORT double vl_svm_l2_dca_update (double alpha, double inner, double norm2, double label)
 SVM l2 loss DCA update.
VL_EXPORT double vl_svm_logistic_loss (double label, double inner)
 SVM l2 loss.
VL_EXPORT double vl_svm_logistic_loss_derivative (double label, double inner)
 SVM l2 loss derivative.
VL_EXPORT double vl_svm_logistic_conjugate_loss (double label, double u)
 SVM l2 loss conjugate.
VL_EXPORT double vl_svm_logistic_dca_update (double alpha, double inner, double norm2, double label)
 SVM l2 loss DCA update.

Detailed Description

Support Vector Machines (Support Vector Machines (SVM))

See also:
Support Vector Machines (SVM).
Author:
Milan Sulc
Daniele Perrone
Andrea Vedaldi

Definition in file svm.h.


Typedef Documentation

SVM solver. This object implements VLFeat SVM solvers (see svm.h).

Definition at line 32 of file svm.h.

SVM statistics This structure contains statistics characterising the state of the SVM solver, such as the current value of the objective function.

Not all fields are used by all solvers.


Enumeration Type Documentation

Type of SVM loss.

Default SVM loss types. The loss can be set by using vl_svm_set_loss. Note that custom losses can be used too by using vl_svm_set_loss_function, vl_svm_set_loss_derivative_function, etc.

See also:
svm-loss-functions
Enumerator:
VlSvmLossHinge 

Standard hinge loss.

VlSvmLossHinge2 

Hinge loss squared.

VlSvmLossL1 

L1 loss.

VlSvmLossL2 

L2 loss.

VlSvmLossLogistic 

Logistic loss.

Definition at line 53 of file svm.h.

Solver status.

Enumerator:
VlSvmStatusTraining 

Optimization in progress.

VlSvmStatusConverged 

Optimization finished because the convergence criterion was met.

VlSvmStatusMaxNumIterationsReached 

Optimization finished without convergence.

Definition at line 63 of file svm.h.

Type of SVM solver.

Enumerator:
VlSvmSolverNone 

No solver (used to evaluate an SVM).

VlSvmSolverSgd 

SGD algorithm (Stochastic Gradient Descent).

VlSvmSolverSdca 

SDCA algorithm (Stochastic Dual Coordinate Ascent).

Definition at line 38 of file svm.h.


Function Documentation

VL_EXPORT void vl_svm_delete ( VlSvm self)

Delete object.

Parameters:
selfobject.
See also:
vl_svm_new

Definition at line 1097 of file svm.c.

VL_EXPORT double vl_svm_get_bias ( VlSvm const *  self)

Get the value of the bias.

Parameters:
selfobject.
Returns:
bias $b$.

The value of the bias returned already include the effect of bias mutliplier.

Definition at line 1422 of file svm.c.

VL_EXPORT double vl_svm_get_bias_learning_rate ( VlSvm const *  self)

Get the bias leraning rate.

Parameters:
selfobject
Returns:
bias learning rate.

Definition at line 1160 of file svm.c.

VL_EXPORT double vl_svm_get_bias_multiplier ( VlSvm const *  self)

Get the bias multiplier.

Parameters:
selfobject.
Returns:
bias multiplier.

Definition at line 1186 of file svm.c.

VL_EXPORT vl_size vl_svm_get_diagnostic_frequency ( VlSvm const *  self)

Get the diagnostic frequency.

Parameters:
selfobject.
Returns:
diagnostic frequency.

Definition at line 1260 of file svm.c.

VL_EXPORT vl_size vl_svm_get_dimension ( VlSvm self)

Get the model dimenison.

Parameters:
selfobject.
Returns:
model dimension.

This is the dimensionality of the weight vector $$.

Definition at line 1348 of file svm.c.

VL_EXPORT double vl_svm_get_epsilon ( VlSvm const *  self)

Get the convergence threshold.

Parameters:
selfobject
Returns:
epsilon threshold.

Definition at line 1135 of file svm.c.

VL_EXPORT vl_size vl_svm_get_iteration_number ( VlSvm const *  self)

Get the current iteration number.

Parameters:
selfobject.
Returns:
current iteration number.

Definition at line 1212 of file svm.c.

VL_EXPORT double vl_svm_get_lambda ( VlSvm const *  self)

Get the regularizer parameter lambda.

Parameters:
selfobject.
Returns:
diagnostic frequency.

Definition at line 1300 of file svm.c.

VL_EXPORT vl_size vl_svm_get_max_num_iterations ( VlSvm const *  self)

Get the maximum number of iterations.

Parameters:
selfobject.
Returns:
maximum number of iterations.

Definition at line 1234 of file svm.c.

VL_EXPORT double const* vl_svm_get_model ( VlSvm const *  self)

Get the SVM model.

Parameters:
selfobject.
Returns:
model.

This is the weight vector $$.

Definition at line 1374 of file svm.c.

VL_EXPORT vl_size vl_svm_get_num_data ( VlSvm self)

Get the number of data samples.

Parameters:
selfobject.
Returns:
model number of data samples

This is the dimensionality of the weight vector $$.

Definition at line 1361 of file svm.c.

VL_EXPORT double const* vl_svm_get_scores ( VlSvm const *  self)

Get the scores of the data points.

Parameters:
selfobject.
Returns:
vector of scores.

After training or during the diagnostic callback, this function can be used to retrieve the scores of the points, i.e. $ , + b$.

Definition at line 1448 of file svm.c.

VL_EXPORT VlSvmSolverType vl_svm_get_solver ( VlSvm const *  self)

Get the SVM solver type.

Parameters:
selfobject.
Returns:
SVM solver type.

Definition at line 1271 of file svm.c.

VL_EXPORT VlSvmStatistics const* vl_svm_get_statistics ( VlSvm const *  self)

Get the solver statistics.

Parameters:
selfobject.
Returns:
statistics.

Definition at line 1433 of file svm.c.

VL_EXPORT double const* vl_svm_get_weights ( VlSvm const *  self)

Get the data weights.

Parameters:
selfobject.
Returns:
data weights.

Definition at line 1331 of file svm.c.

VL_EXPORT double vl_svm_hinge2_conjugate_loss ( double  u,
double  label 
)

SVM square hinge loss conjugate.

Parameters:
udual variable.
labellabel value.
Returns:
conjugate loss.

Definition at line 1667 of file svm.c.

VL_EXPORT double vl_svm_hinge2_dca_update ( double  alpha,
double  inner,
double  norm2,
double  label 
)

SVM square hinge loss DCA update.

Parameters:
alphacurrent value of the dual variable.
innerinner product $^ $ of the sample with the SVM model.
norm2normalization factor $\|\|^2/ n$.
labellabel $y$ of the sample.
Returns:
incremental update $$ of the dual variable.
See also:
Stochastic Dual Coordinate Ascent

Definition at line 1678 of file svm.c.

VL_EXPORT double vl_svm_hinge2_loss ( double  inner,
double  label 
)

SVM square hinge loss.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1646 of file svm.c.

VL_EXPORT double vl_svm_hinge2_loss_derivative ( double  inner,
double  label 
)

SVM square hinge loss derivative.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1655 of file svm.c.

VL_EXPORT double vl_svm_hinge_conjugate_loss ( double  u,
double  label 
)

SVM hinge loss conjugate.

Parameters:
udual variable.
labellabel value.
Returns:
conjugate loss.

Definition at line 1626 of file svm.c.

VL_EXPORT double vl_svm_hinge_dca_update ( double  alpha,
double  inner,
double  norm2,
double  label 
)

SVM hinge loss DCA update.

Parameters:
alphacurrent value of the dual variable.
innerinner product $^ $ of the sample with the SVM model.
norm2normalization factor $\|\|^2/ n$.
labellabel $y$ of the sample.
Returns:
incremental update $$ of the dual variable.
See also:
Stochastic Dual Coordinate Ascent

Definition at line 1638 of file svm.c.

VL_EXPORT double vl_svm_hinge_loss ( double  inner,
double  label 
)

SVM hinge loss.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1603 of file svm.c.

VL_EXPORT double vl_svm_hinge_loss_derivative ( double  inner,
double  label 
)

SVM hinge loss derivative.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1611 of file svm.c.

VL_EXPORT double vl_svm_l1_conjugate_loss ( double  u,
double  label 
)

SVM l1 loss conjugate.

Parameters:
udual variable.
labellabel value.
Returns:
conjugate loss.

Definition at line 1706 of file svm.c.

VL_EXPORT double vl_svm_l1_dca_update ( double  alpha,
double  inner,
double  norm2,
double  label 
)

SVM l1 loss DCA update.

Parameters:
alphacurrent value of the dual variable.
innerinner product $^ $ of the sample with the SVM model.
norm2normalization factor $\|\|^2/ n$.
labellabel $y$ of the sample.
Returns:
incremental update $$ of the dual variable.
See also:
Stochastic Dual Coordinate Ascent

Definition at line 1717 of file svm.c.

VL_EXPORT double vl_svm_l1_loss ( double  inner,
double  label 
)

SVM l1 loss.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1686 of file svm.c.

VL_EXPORT double vl_svm_l1_loss_derivative ( double  inner,
double  label 
)

SVM l1 loss derivative.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1694 of file svm.c.

VL_EXPORT double vl_svm_l2_conjugate_loss ( double  u,
double  label 
)

SVM l2 loss conjugate.

Parameters:
udual variable.
labellabel value.
Returns:
conjugate loss.

Definition at line 1746 of file svm.c.

VL_EXPORT double vl_svm_l2_dca_update ( double  alpha,
double  inner,
double  norm2,
double  label 
)

SVM l2 loss DCA update.

Parameters:
alphacurrent value of the dual variable.
innerinner product $^ $ of the sample with the SVM model.
norm2normalization factor $\|\|^2/ n$.
labellabel $y$ of the sample.
Returns:
incremental update $$ of the dual variable.
See also:
Stochastic Dual Coordinate Ascent

Definition at line 1753 of file svm.c.

VL_EXPORT double vl_svm_l2_loss ( double  inner,
double  label 
)

SVM l2 loss.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1729 of file svm.c.

VL_EXPORT double vl_svm_l2_loss_derivative ( double  inner,
double  label 
)

SVM l2 loss derivative.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1738 of file svm.c.

VL_EXPORT double vl_svm_logistic_conjugate_loss ( double  u,
double  label 
)

SVM l2 loss conjugate.

Parameters:
udual variable.
labellabel value.
Returns:
conjugate loss.

Definition at line 1789 of file svm.c.

VL_EXPORT double vl_svm_logistic_dca_update ( double  alpha,
double  inner,
double  norm2,
double  label 
)

SVM l2 loss DCA update.

Parameters:
alphacurrent value of the dual variable.
innerinner product $^ $ of the sample with the SVM model.
norm2normalization factor $\|\|^2/ n$.
labellabel $y$ of the sample.
Returns:
incremental update $$ of the dual variable.
See also:
Stochastic Dual Coordinate Ascent

Definition at line 1801 of file svm.c.

VL_EXPORT double vl_svm_logistic_loss ( double  inner,
double  label 
)

SVM l2 loss.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1760 of file svm.c.

VL_EXPORT double vl_svm_logistic_loss_derivative ( double  inner,
double  label 
)

SVM l2 loss derivative.

Parameters:
innerinner product between sample and model $^ $.
labelsample label $y$.
Returns:
value of the loss.

The interface is the same for a loss function, its derivative, or the conjugate loss.

See also:
SVM fundamentals

Definition at line 1773 of file svm.c.

VL_EXPORT VlSvm* vl_svm_new ( VlSvmSolverType  type,
double const *  data,
vl_size  dimension,
vl_size  numData,
double const *  labels,
double  lambda 
)

Create a new object with plain data.

Parameters:
typetype of SMV solver.
dataa pointer to a matrix of data.
dimensiondimension of the SVM model.
numDatanumber of training samples.
labelstraining labels.
lambdaregularizer parameter.
Returns:
the new object.

data has one column per sample, in double format. More advanced inputs can be used with vl_svm_new_with_dataset and vl_svm_new_with_abstract_data.

See also:
vl_svm_delete

Definition at line 957 of file svm.c.

VL_EXPORT VlSvm* vl_svm_new_with_abstract_data ( VlSvmSolverType  solver,
void data,
vl_size  dimension,
vl_size  numData,
double const *  labels,
double  lambda 
)

Create a new object with abstract data.

Parameters:
solvertype of SMV solver.
datapointer to the data.
dimensiondimension of the SVM model.
numDatanum training samples.
labelstraining samples labels.
lambdaregularizer parameter.
Returns:
the new object.

After calling this function, vl_svm_set_data_functions *must* be used to setup suitable callbacks for the inner product and accumulation operations (

See also:
svm-data-abstraction).
vl_svm_delete

Definition at line 1014 of file svm.c.

VL_EXPORT VlSvm* vl_svm_new_with_dataset ( VlSvmSolverType  solver,
VlSvmDataset dataset,
double const *  labels,
double  lambda 
)

Create a new object with a dataset.

Parameters:
solvertype of SMV solver.
datasetSVM dataset object
labelstraining samples labels.
lambdaregularizer parameter.
Returns:
the new object.
See also:
vl_svm_delete

Definition at line 980 of file svm.c.

VL_EXPORT void vl_svm_set_bias ( VlSvm self,
double  b 
)

Set the SVM bias.

Parameters:
selfobject.
bbias.

The function set the internal representation of the SVM bias to be equal to b (the bias multiplier is applied). The same remark that applies to vl_svm_set_model applies here too.

Definition at line 1406 of file svm.c.

VL_EXPORT void vl_svm_set_bias_learning_rate ( VlSvm self,
double  rate 
)

Set the bias learning rate.

Parameters:
selfobject
ratebias learning rate (positive).

This parameter applies only to the SGD solver.

Definition at line 1148 of file svm.c.

VL_EXPORT void vl_svm_set_bias_multiplier ( VlSvm self,
double  b 
)

Set the bias multiplier.

Parameters:
selfobject
bbias multiplier.

The *bias multiplier* is the value of the constant feature appended to the data vectors to implement the bias (Adding a bias).

Definition at line 1174 of file svm.c.

Set the conjugate loss function callback.

Parameters:
selfobject.
floss function callback.

Note that setting up a loss requires specifying more than just one callback. See Loss functions for details.

.

Definition at line 1529 of file svm.c.

Set the data functions.

Parameters:
selfobject.
innerinner product function.
accaccumulate function.

See svm-data-abstraction.

Definition at line 1492 of file svm.c.

Set the DCA update function callback.

Parameters:
selfobject.
floss function callback.

Note that setting up a loss requires specifying more than just one callback. See Loss functions for details.

.

Definition at line 1539 of file svm.c.

VL_EXPORT void vl_svm_set_diagnostic_frequency ( VlSvm self,
vl_size  f 
)

Set the diagnostic frequency.

Parameters:
selfobject.
fdiagnostic frequency (>= 1).

A diagnostic round (to test for convergence and to printout information) is performed every f iterations.

Definition at line 1248 of file svm.c.

VL_EXPORT void vl_svm_set_diagnostic_function ( VlSvm self,
VlSvmDiagnosticFunction  f,
void data 
)

Set the diagnostic function callback.

Parameters:
selfobject.
fdiagnostic function pointer.
datapointer to data used by the diagnostic function.

Definition at line 1479 of file svm.c.

VL_EXPORT void vl_svm_set_epsilon ( VlSvm self,
double  epsilon 
)

Set the convergence threshold.

Parameters:
selfobject
epsilonthreshold (non-negative).

Definition at line 1123 of file svm.c.

VL_EXPORT void vl_svm_set_iteration_number ( VlSvm self,
vl_uindex  n 
)

Set the current iteratio number.

Parameters:
selfobject.
niteration number.

If called before training, this can be used with SGD for a warm start, as the net effect is to slow down the learning rate.

Definition at line 1201 of file svm.c.

VL_EXPORT void vl_svm_set_loss ( VlSvm self,
VlSvmLossType  loss 
)

Set the loss function to one of the default types.

Parameters:
selfobject.
losstype of loss function.
See also:
Loss functions.

Definition at line 1552 of file svm.c.

Set the loss derivative function callback.

Parameters:
selfobject.
floss function callback.

Note that setting up a loss requires specifying more than just one callback. See Loss functions for details.

.

Definition at line 1519 of file svm.c.

VL_EXPORT void vl_svm_set_loss_function ( VlSvm self,
VlSvmLossFunction  f 
)

Set the loss function callback.

Parameters:
selfobject.
floss function callback.

Note that setting up a loss requires specifying more than just one callback. See Loss functions for details.

Definition at line 1509 of file svm.c.

VL_EXPORT void vl_svm_set_max_num_iterations ( VlSvm self,
vl_size  n 
)

Set the maximum number of iterations.

Parameters:
selfobject.
nmaximum number of iterations.

Definition at line 1223 of file svm.c.

VL_EXPORT void vl_svm_set_model ( VlSvm self,
double const *  model 
)

Set the SVM model.

Parameters:
selfobject.
modelmodel.

The function *copies* the content of the vector model to the internal model buffer. This operation can be used for warm start with the SGD algorithm, but has undefined effect with the SDCA algorithm.

Definition at line 1389 of file svm.c.

VL_EXPORT void vl_svm_set_weights ( VlSvm self,
double const *  weights 
)

Set the data weights.

Parameters:
selfobject.
weightsdata weights.

weights must be an array of non-negative weights. The loss of each data point is multiplied by the corresponding weight.

Set weights to NULL to weight the data uniformly by 1 (default).

Note that the weights array is *not* copied and must be valid througout the object lifetime (unless it is replaced).

Definition at line 1320 of file svm.c.

VL_EXPORT void vl_svm_train ( VlSvm self)

Run the SVM solver.

Parameters:
selfobject.

The data on which the SVM operates is passed upon the cration of the VlSvm object. This function runs a solver to learn a corresponding model. See Getting started.

Definition at line 2156 of file svm.c.



libvlfeat
Author(s): Andrea Vedaldi
autogenerated on Thu Jun 6 2019 20:25:52