13 #ifndef MLPACK_METHODS_SPARSE_SVM_SPARSE_SVM_FUNCTION_HPP
14 #define MLPACK_METHODS_SPARSE_SVM_SPARSE_SVM_FUNCTION_HPP
41 double Evaluate(
const arma::mat& parameters,
43 const size_t batchSize = 1);
53 template <
typename GradType>
54 void Gradient(
const arma::mat& parameters,
size_t id, GradType& gradient);
62 const arma::sp_mat&
Dataset()
const {
return dataset; }
64 arma::sp_mat&
Dataset() {
return dataset; }
67 const arma::vec&
Labels()
const {
return labels; }
69 arma::vec&
Labels() {
return labels; }
76 arma::mat initialPoint;
86 #include "sparse_svm_function_impl.hpp"
88 #endif // MLPACK_METHODS_SPARSE_SVM_SPARSE_SVM_FUNCTION_HPP
void Shuffle()
Shuffle the dataset.
The core includes that mlpack expects; standard C++ includes and Armadillo.
const arma::sp_mat & Dataset() const
Get the dataset.
arma::vec & Labels()
Modify the labels.
double Evaluate(const arma::mat ¶meters, const size_t startId, const size_t batchSize=1)
Evaluate the hinge loss function on the specified datapoints.
size_t NumFunctions()
Return the number of functions.
void Gradient(const arma::mat ¶meters, size_t id, GradType &gradient)
Evaluate the gradient the gradient of the hinge loss function, following the SparseFunctionType requi...
arma::mat & InitialPoint()
Modify the initial point for the optimization.
arma::sp_mat & Dataset()
Modify the dataset.
const arma::vec & Labels() const
Get the labels.
const arma::mat & InitialPoint() const
Return the initial point for the optimization.
SparseSVMFunction()
Nothing to do for the default constructor.