SVDPlusPlus< OptimizerType > Class Template Reference

SVD++ is a matrix decomposition tenique used in collaborative filtering. More...

Public Member Functions

 SVDPlusPlus (const size_t iterations=10, const double alpha=0.001, const double lambda=0.1)
 Constructor of SVDPlusPlus. More...

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

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

 

Static Public Member Functions

static void CleanData (const arma::mat &implicitData, arma::sp_mat &cleanedData, const arma::mat &data)
 Converts the User, Item matrix of implicit data to Item-User Table. More...

 

Detailed Description


template
<
typename
OptimizerType
=
ens::StandardSGD
>

class mlpack::svd::SVDPlusPlus< OptimizerType >

SVD++ is a matrix decomposition tenique used in collaborative filtering.

SVD++ is similar to BiasSVD, but it is a more expressive model because SVD++ also models implicit feedback. SVD++ outputs user/item latent vectors, user/item bias, and item vectors with regard to implicit feedback. Parameters are optmized by Stochastic Gradient Desent(SGD). The updates also penalize the learning of large feature values by means of regularization.

For more information, see the following paper:

@inproceedings{koren2008factorization,
title={Factorization meets the neighborhood: a multifaceted collaborative
filtering model},
author={Koren, Yehuda},
booktitle={Proceedings of the 14th ACM SIGKDD international conference on
Knowledge discovery and data mining},
pages={426--434},
year={2008},
organization={ACM}
}

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

arma::mat data; // Rating data in the form of coordinate list.
// Implicit feedback data in the form of coordinate list.
arma::mat implicitData;
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.001 // Learning rate for the SGD optimizer.
const double lambda = 0.1 // Regularization parameter for the optimization.
// Make a SVD++ object.
SVDPlusPlus<> svdPP(iterations, alpha, lambda);
arma::mat u, v; // Item and User matrices.
arma::vec p, q; // Item and User bias.
arma::mat y; // Item matrix with respect to implicit feedback.
// Use the Apply() method to get a factorization.
svdPP.Apply(data, implicitData, rank, u, v, p, q, y);

Definition at line 76 of file svdplusplus.hpp.

Constructor & Destructor Documentation

◆ SVDPlusPlus()

SVDPlusPlus ( const size_t  iterations = 10,
const double  alpha = 0.001,
const double  lambda = 0.1 
)

Constructor of SVDPlusPlus.

By default SGD optimizer is used in SVDPlusPlus. 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() [1/2]

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

Trains the model and obtains user/item matrices, user/item bias, and item implicit matrix.

Parameters
dataRating data matrix.
implicitDataImplicit feedback.
rankRank parameter to be used for optimization.
uItem matrix obtained on decomposition.
vUser matrix obtained on decomposition.
pItem bias.
qUser bias.
yItem matrix with respect to implicit feedback.

Referenced by SVDPlusPlusPolicy::Apply().

◆ Apply() [2/2]

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

Trains the model and obtains user/item matrices, user/item bias, and item implicit matrix.

Whether a user rates an item is used as implicit feedback.

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.
yItem matrix with respect to implicit feedback. Each column is a latent vector of an item with respect to implicit feedback.

◆ CleanData()

static void CleanData ( const arma::mat &  implicitData,
arma::sp_mat &  cleanedData,
const arma::mat &  data 
)
static

Converts the User, Item matrix of implicit data to Item-User Table.

Referenced by SVDPlusPlusPolicy::Apply().


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