mlpack
master
|
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 ¶meters) const |
Evaluates the cost function over all examples in the data. More... | |
double | Evaluate (const arma::mat ¶meters, 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 ¶meters, 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... | |
Definition at line 22 of file regularized_svd_function.hpp.
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.
data | Dataset for which SVD is calculated. |
rank | Rank used for matrix factorization. |
lambda | Regularization parameter used for optimization. |
|
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 | Parameters(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 | Parameters(user/item matrices) of the decomposition. |
i | Index of the training example to be used. |
|
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 | Parameters(user/item matrices) of the decomposition. |
gradient | Calculated gradient for the parameters. |
|
inline |
Return the regularization parameters.
Definition at line 82 of file regularized_svd_function.hpp.
References lambda.
|
inline |
Return the number of training examples. Useful for SGD optimizer.
Definition at line 73 of file regularized_svd_function.hpp.
|
inline |
Return the number of items in the data.
Definition at line 79 of file regularized_svd_function.hpp.
References numItems.
|
inline |
Return the number of users in the data.
Definition at line 76 of file regularized_svd_function.hpp.
References numUsers.
|
inline |
Return the rank used for the factorization.
Definition at line 85 of file regularized_svd_function.hpp.
References rank.
|
private |
|
private |
Initial parameter point.
Definition at line 91 of file regularized_svd_function.hpp.
Referenced by GetInitialPoint().
|
private |
Regularization parameter for the optimization.
Definition at line 95 of file regularized_svd_function.hpp.
Referenced by Lambda().
|
private |
Number of items in the given dataset.
Definition at line 99 of file regularized_svd_function.hpp.
Referenced by NumItems().
|
private |
Number of users in the given dataset.
Definition at line 97 of file regularized_svd_function.hpp.
Referenced by NumUsers().
|
private |
Rank used for matrix factorization.
Definition at line 93 of file regularized_svd_function.hpp.
Referenced by Rank().