BiasSVD< OptimizerType > Class Template Reference

Bias SVD is an improvement on Regularized SVD which is a matrix factorization techniques. More...

Public Member Functions

 BiasSVD (const size_t iterations=10, const double alpha=0.02, const double lambda=0.05)
 Constructor of Bias SVD. More...

 
void Apply (const arma::mat &data, const size_t rank, arma::mat &u, arma::mat &v, arma::vec &p, arma::vec &q)
 Trains the model and obtains user/item matrices and user/item bias. More...

 

Detailed Description


template
<
typename
OptimizerType
=
ens::StandardSGD
>

class mlpack::svd::BiasSVD< OptimizerType >

Bias SVD is an improvement on Regularized SVD which is a matrix factorization techniques.

Bias SVD outputs user/item latent vectors and user/item bias, so that $ r_{iu} = b_i + b_u + p_i * q_u $, where b, p, q are bias, item latent, user latent respectively. Parameters are optmized by Stochastic Gradient Desent(SGD). The updates also penalize the learning of large feature values by means of regularization.

An example of how to use the interface is shown below:

arma::mat data; // Rating data in the form of coordinate list.
const size_t rank = 10; // Rank used for the decomposition.
const size_t iterations = 10; // Number of iterations used for optimization.
const double alpha = 0.005 // Learning rate for the SGD optimizer.
const double lambda = 0.02 // Regularization parameter for the optimization.
// Make a BiasSVD object.
BiasSVD<> biasSVD(iterations, alpha, lambda);
arma::mat u, v; // Item and User matrices.
arma::vec p, q; // Item and User bias.
// Use the Apply() method to get a factorization.
rSVD.Apply(data, rank, u, v, p, q);

Definition at line 57 of file bias_svd.hpp.

Constructor & Destructor Documentation

◆ BiasSVD()

BiasSVD ( const size_t  iterations = 10,
const double  alpha = 0.02,
const double  lambda = 0.05 
)

Constructor of Bias SVD.

By default SGD optimizer is used in BiasSVD. The optimizer uses a template specialization of Optimize().

Parameters
iterationsNumber of optimization iterations.
alphaLearning rate for the SGD optimizer.
lambdaRegularization parameter for the optimization.

Member Function Documentation

◆ Apply()

void Apply ( const arma::mat &  data,
const size_t  rank,
arma::mat &  u,
arma::mat &  v,
arma::vec &  p,
arma::vec &  q 
)

Trains the model and obtains user/item matrices and user/item bias.

Parameters
dataRating data matrix.
rankRank parameter to be used for optimization.
uItem matrix obtained on decomposition.
vUser matrix obtained on decomposition.
pItem bias.
qUser bias.

Referenced by BiasSVDPolicy::Apply().


The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-git/src/mlpack/methods/bias_svd/bias_svd.hpp