mlpack  3.0.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
SparseSVMFunction Class Reference

Public Member Functions

 SparseSVMFunction ()
 Nothing to do for the default constructor. More...
 
 SparseSVMFunction (const arma::sp_mat &dataset, const arma::vec &labels)
 Member initialization constructor. More...
 
const arma::sp_mat & Dataset () const
 Get the dataset. More...
 
arma::sp_mat & Dataset ()
 Modify the dataset. More...
 
double Evaluate (const arma::mat &parameters, const size_t startId, const size_t batchSize=1)
 Evaluate the hinge loss function on the specified datapoints. More...
 
template<typename GradType >
void Gradient (const arma::mat &parameters, size_t id, GradType &gradient)
 Evaluate the gradient the gradient of the hinge loss function, following the SparseFunctionType requirements on the Gradient function. More...
 
const arma::mat & InitialPoint () const
 Return the initial point for the optimization. More...
 
arma::mat & InitialPoint ()
 Modify the initial point for the optimization. More...
 
const arma::vec & Labels () const
 Get the labels. More...
 
arma::vec & Labels ()
 Modify the labels. More...
 
size_t NumFunctions ()
 Return the number of functions. More...
 
void Shuffle ()
 Shuffle the dataset. More...
 

Detailed Description

Definition at line 18 of file sparse_svm_function.hpp.

Constructor & Destructor Documentation

SparseSVMFunction ( )
inline

Nothing to do for the default constructor.

Definition at line 22 of file sparse_svm_function.hpp.

SparseSVMFunction ( const arma::sp_mat &  dataset,
const arma::vec &  labels 
)

Member initialization constructor.

Member Function Documentation

const arma::sp_mat& Dataset ( ) const
inline

Get the dataset.

Definition at line 62 of file sparse_svm_function.hpp.

arma::sp_mat& Dataset ( )
inline

Modify the dataset.

Definition at line 64 of file sparse_svm_function.hpp.

double Evaluate ( const arma::mat &  parameters,
const size_t  startId,
const size_t  batchSize = 1 
)

Evaluate the hinge loss function on the specified datapoints.

Parameters
parametersThe parameters of the SVM.
startIdFirst index of the datapoints to use for function evaluation.
batchSizeSize of batch to process.
Returns
The value of the loss function at the given parameters.
void Gradient ( const arma::mat &  parameters,
size_t  id,
GradType &  gradient 
)

Evaluate the gradient the gradient of the hinge loss function, following the SparseFunctionType requirements on the Gradient function.

Parameters
parametersThe parameters of the SVM.
idIndex of the datapoint to use for the gradient evaluation.
gradientSparse matrix to output the gradient into.
const arma::mat& InitialPoint ( ) const
inline

Return the initial point for the optimization.

Definition at line 57 of file sparse_svm_function.hpp.

arma::mat& InitialPoint ( )
inline

Modify the initial point for the optimization.

Definition at line 59 of file sparse_svm_function.hpp.

const arma::vec& Labels ( ) const
inline

Get the labels.

Definition at line 67 of file sparse_svm_function.hpp.

arma::vec& Labels ( )
inline

Modify the labels.

Definition at line 69 of file sparse_svm_function.hpp.

size_t NumFunctions ( )

Return the number of functions.

void Shuffle ( )

Shuffle the dataset.


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