This class contains methods which are used to calculate the cost of BiasSVD's objective function, to calculate gradient of parameters with respect to the objective function, etc.
More...
|
| | BiasSVDFunction (const MatType &data, const size_t rank, const double lambda) |
| | Constructor for BiasSVDFunction 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 start, const size_t batchSize=1) 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...
|
| |
| template<typename GradType > |
| void | Gradient (const arma::mat ¶meters, const size_t start, GradType &gradient, const size_t batchSize=1) const |
| | Evaluates the gradient of the cost function over one training example. 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...
|
| |
| void | Shuffle () |
| | Shuffle the points in the dataset. More...
|
| |
template<typename MatType = arma::mat>
class mlpack::svd::BiasSVDFunction< MatType >
This class contains methods which are used to calculate the cost of BiasSVD's objective function, to calculate gradient of parameters with respect to the objective function, etc.
- Template Parameters
-
| MatType | The matrix type of the dataset. |
Definition at line 31 of file bias_svd_function.hpp.
| BiasSVDFunction |
( |
const MatType & |
data, |
|
|
const size_t |
rank, |
|
|
const double |
lambda |
|
) |
| |
Constructor for BiasSVDFunction class.
The constructor calculates the number of users and items in the passed data. It also randomly initializes the parameter values.
- Parameters
-
| data | Dataset for which SVD is calculated. |
| rank | Rank used for matrix factorization. |
| lambda | Regularization parameter used for optimization. |
| const arma::mat& Dataset |
( |
| ) |
const |
|
inline |
| double Evaluate |
( |
const arma::mat & |
parameters | ) |
const |
Evaluates the cost function over all examples in the data.
- Parameters
-
| parameters | Parameters(user/item matrices/bias) of the decomposition. |
| double Evaluate |
( |
const arma::mat & |
parameters, |
|
|
const size_t |
start, |
|
|
const size_t |
batchSize = 1 |
|
) |
| 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 | Parameters(user/item matrices/bias) of the decomposition. |
| start | First index of the training examples to be used. |
| batchSize | Size of batch to evaluate. |
| const arma::mat& GetInitialPoint |
( |
| ) |
const |
|
inline |
| void Gradient |
( |
const arma::mat & |
parameters, |
|
|
arma::mat & |
gradient |
|
) |
| const |
Evaluates the full gradient of the cost function over all the training examples.
- Parameters
-
| parameters | Parameters(user/item matrices/bias) of the decomposition. |
| gradient | Calculated gradient for the parameters. |
| void Gradient |
( |
const arma::mat & |
parameters, |
|
|
const size_t |
start, |
|
|
GradType & |
gradient, |
|
|
const size_t |
batchSize = 1 |
|
) |
| const |
Evaluates the gradient of the cost function over one training example.
This function is useful for optimizers like SGD. The type of the gradient parameter is a template argument to allow the computation of a sparse gradient.
- Template Parameters
-
| GradType | The type of the gradient out-param. |
- Parameters
-
| parameters | Parameters(user/item matrices/bias) of the decomposition. |
| start | The first index of the training examples to use. |
| gradient | Calculated gradient for the parameters. |
| batchSize | Size of batch to calculate gradient for. |
| size_t NumFunctions |
( |
| ) |
const |
|
inline |
| size_t NumItems |
( |
| ) |
const |
|
inline |
| size_t NumUsers |
( |
| ) |
const |
|
inline |
Shuffle the points in the dataset.
This may be used by optimizers.
The documentation for this class was generated from the following file: