---
name: "mlpack_svd_RegularizedSVDFunction"
section: "3"
platform: "linux"
package: "mlpack-doc"
version: "1.0.10-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_svd_RegularizedSVDFunction"
---

# mlpack\_svd\_RegularizedSVDFunction(3)

## NAME

mlpack::svd::RegularizedSVDFunction -

## SYNOPSIS

### Public Member Functions

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

### Private Attributes

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

## Detailed Description

Definition at line 32 of file regularized\_svd\_function.hpp.

## Constructor & Destructor Documentation

### mlpack::svd::RegularizedSVDFunction::RegularizedSVDFunction (const arma::mat &data, const size\_trank, const doublelambda)

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:**

*data* Dataset for which SVD is calculated. \
 *rank* Rank used for matrix factorization. \
 *lambda* Regularization 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 80 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* Parameters(user/item matrices) of the decomposition.

### double mlpack::svd::RegularizedSVDFunction::Evaluate (const arma::mat &parameters, const size\_ti) 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) of the decomposition. \
 *i* Index 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 77 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* Parameters(user/item matrices) of the decomposition. \
 *gradient* Calculated gradient for the parameters.

### double mlpack::svd::RegularizedSVDFunction::Lambda () const` [inline]`

Return the regularization parameters.

Definition at line 92 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 83 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 89 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 86 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 95 of file regularized\_svd\_function.hpp.

References rank.

## Member Data Documentation

### const arma::mat& mlpack::svd::RegularizedSVDFunction::data` [private]`

Rating data.

Definition at line 99 of file regularized\_svd\_function.hpp.

Referenced by Dataset().

### arma::mat mlpack::svd::RegularizedSVDFunction::initialPoint` [private]`

Initial parameter point.

Definition at line 101 of file regularized\_svd\_function.hpp.

Referenced by GetInitialPoint().

### double mlpack::svd::RegularizedSVDFunction::lambda` [private]`

Regularization parameter for the optimization.

Definition at line 105 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 109 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 107 of file regularized\_svd\_function.hpp.

Referenced by NumUsers().

### size\_t mlpack::svd::RegularizedSVDFunction::rank` [private]`

Rank used for matrix factorization.

Definition at line 103 of file regularized\_svd\_function.hpp.

Referenced by Rank().

## Author

Generated automatically by Doxygen for MLPACK from the source code.
