13 #ifndef MLPACK_METHODS_REGULARIZED_SVD_REGULARIZED_FUNCTION_SVD_HPP
14 #define MLPACK_METHODS_REGULARIZED_SVD_REGULARIZED_FUNCTION_SVD_HPP
30 template <
typename MatType = arma::mat>
57 double Evaluate(
const arma::mat& parameters)
const;
67 double Evaluate(
const arma::mat& parameters,
69 const size_t batchSize = 1)
const;
78 void Gradient(
const arma::mat& parameters,
79 arma::mat& gradient)
const;
93 template <
typename GradType>
94 void Gradient(
const arma::mat& parameters,
97 const size_t batchSize = 1)
const;
103 const arma::mat&
Dataset()
const {
return data; }
118 size_t Rank()
const {
return rank; }
124 arma::mat initialPoint;
139 namespace optimization {
151 arma::mat& parameters);
157 arma::mat& parameters);
162 #include "regularized_svd_function_impl.hpp"
double Optimize(SparseFunctionType &function, arma::mat &iterate)
Optimize the given function using the parallel SGD algorithm.
void Shuffle()
Shuffle the points in the dataset.
double Lambda() const
Return the regularization parameters.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Evaluate(const arma::mat ¶meters) const
Evaluates the cost function over all examples in the data.
size_t NumItems() const
Return the number of items in the data.
size_t Rank() const
Return the rank used for the factorization.
size_t NumUsers() const
Return the number of users in the data.
RegularizedSVDFunction(const MatType &data, const size_t rank, const double lambda)
Constructor for RegularizedSVDFunction class.
void Gradient(const arma::mat ¶meters, arma::mat &gradient) const
Evaluates the full gradient of the cost function over all the training examples.
const arma::mat & Dataset() const
Return the dataset passed into the constructor.
size_t NumFunctions() const
Return the number of training examples. Useful for SGD optimizer.
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using stochastic gradient descent.
The data is stored in a matrix of type MatType, so that this class can be used with both dense and sp...
const arma::mat & GetInitialPoint() const
Return the initial point for the optimization.