mlpack  master
Public Member Functions | Private Attributes | List of all members
mlpack::svd::RegularizedSVDFunction Class Reference

Public Member Functions

 RegularizedSVDFunction (const arma::mat &data, const size_t rank, const double lambda)
 Constructor for RegularizedSVDFunction class. More...
 
const arma::mat & Dataset () const
 Return the dataset passed into the constructor. More...
 
double Evaluate (const arma::mat &parameters) const
 Evaluates the cost function over all examples in the data. More...
 
double Evaluate (const arma::mat &parameters, const size_t i) const
 Evaluates the cost function for one training example. More...
 
const arma::mat & GetInitialPoint () const
 Return the initial point for the optimization. More...
 
void Gradient (const arma::mat &parameters, arma::mat &gradient) const
 Evaluates the full gradient of the cost function over all the training examples. More...
 
double Lambda () const
 Return the regularization parameters. More...
 
size_t NumFunctions () const
 Return the number of training examples. Useful for SGD optimizer. More...
 
size_t NumItems () const
 Return the number of items in the data. More...
 
size_t NumUsers () const
 Return the number of users in the data. More...
 
size_t Rank () const
 Return the rank used for the factorization. More...
 

Private Attributes

const arma::mat & data
 Rating data. More...
 
arma::mat initialPoint
 Initial parameter point. More...
 
double lambda
 Regularization parameter for the optimization. More...
 
size_t numItems
 Number of items in the given dataset. More...
 
size_t numUsers
 Number of users in the given dataset. More...
 
size_t rank
 Rank used for matrix factorization. More...
 

Detailed Description

Definition at line 22 of file regularized_svd_function.hpp.

Constructor & Destructor Documentation

mlpack::svd::RegularizedSVDFunction::RegularizedSVDFunction ( const arma::mat &  data,
const size_t  rank,
const double  lambda 
)

Constructor for RegularizedSVDFunction class.

The constructor calculates the number of users and items in the passed data. It also randomly initializes the parameter values.

Parameters
dataDataset for which SVD is calculated.
rankRank used for matrix factorization.
lambdaRegularization parameter used for optimization.

Member Function Documentation

const arma::mat& mlpack::svd::RegularizedSVDFunction::Dataset ( ) const
inline

Return the dataset passed into the constructor.

Definition at line 70 of file regularized_svd_function.hpp.

References data.

double mlpack::svd::RegularizedSVDFunction::Evaluate ( const arma::mat &  parameters) const

Evaluates the cost function over all examples in the data.

Parameters
parametersParameters(user/item matrices) of the decomposition.
double mlpack::svd::RegularizedSVDFunction::Evaluate ( const arma::mat &  parameters,
const size_t  i 
) const

Evaluates the cost function for one training example.

Useful for the SGD optimizer abstraction which uses one training example at a time.

Parameters
parametersParameters(user/item matrices) of the decomposition.
iIndex of the training example to be used.
const arma::mat& mlpack::svd::RegularizedSVDFunction::GetInitialPoint ( ) const
inline

Return the initial point for the optimization.

Definition at line 67 of file regularized_svd_function.hpp.

References initialPoint.

void mlpack::svd::RegularizedSVDFunction::Gradient ( const arma::mat &  parameters,
arma::mat &  gradient 
) const

Evaluates the full gradient of the cost function over all the training examples.

Parameters
parametersParameters(user/item matrices) of the decomposition.
gradientCalculated gradient for the parameters.
double mlpack::svd::RegularizedSVDFunction::Lambda ( ) const
inline

Return the regularization parameters.

Definition at line 82 of file regularized_svd_function.hpp.

References lambda.

size_t mlpack::svd::RegularizedSVDFunction::NumFunctions ( ) const
inline

Return the number of training examples. Useful for SGD optimizer.

Definition at line 73 of file regularized_svd_function.hpp.

size_t mlpack::svd::RegularizedSVDFunction::NumItems ( ) const
inline

Return the number of items in the data.

Definition at line 79 of file regularized_svd_function.hpp.

References numItems.

size_t mlpack::svd::RegularizedSVDFunction::NumUsers ( ) const
inline

Return the number of users in the data.

Definition at line 76 of file regularized_svd_function.hpp.

References numUsers.

size_t mlpack::svd::RegularizedSVDFunction::Rank ( ) const
inline

Return the rank used for the factorization.

Definition at line 85 of file regularized_svd_function.hpp.

References rank.

Member Data Documentation

const arma::mat& mlpack::svd::RegularizedSVDFunction::data
private

Rating data.

Definition at line 89 of file regularized_svd_function.hpp.

Referenced by Dataset().

arma::mat mlpack::svd::RegularizedSVDFunction::initialPoint
private

Initial parameter point.

Definition at line 91 of file regularized_svd_function.hpp.

Referenced by GetInitialPoint().

double mlpack::svd::RegularizedSVDFunction::lambda
private

Regularization parameter for the optimization.

Definition at line 95 of file regularized_svd_function.hpp.

Referenced by Lambda().

size_t mlpack::svd::RegularizedSVDFunction::numItems
private

Number of items in the given dataset.

Definition at line 99 of file regularized_svd_function.hpp.

Referenced by NumItems().

size_t mlpack::svd::RegularizedSVDFunction::numUsers
private

Number of users in the given dataset.

Definition at line 97 of file regularized_svd_function.hpp.

Referenced by NumUsers().

size_t mlpack::svd::RegularizedSVDFunction::rank
private

Rank used for matrix factorization.

Definition at line 93 of file regularized_svd_function.hpp.

Referenced by Rank().


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