SVDPlusPlusPolicy Class Reference

Implementation of the SVDPlusPlus policy to act as a wrapper when accessing SVDPlusPlus from within CFType. More...

Public Member Functions

 SVDPlusPlusPolicy (const size_t maxIterations=10, const double alpha=0.001, const double lambda=0.1)
 Use SVDPlusPlus method to perform collaborative filtering. More...

 
double Alpha () const
 Get learning rate. More...

 
double & Alpha ()
 Modify learning rate. More...

 
void Apply (const arma::mat &data, const arma::sp_mat &, const size_t rank, const size_t maxIterations, const double, const bool)
 Apply Collaborative Filtering to the provided data set using the svdplusplus. More...

 
template
<
typename
NeighborSearchPolicy
>
void GetNeighborhood (const arma::Col< size_t > &users, const size_t numUsersForSimilarity, arma::Mat< size_t > &neighborhood, arma::mat &similarities) const
 Get the neighborhood and corresponding similarities for a set of users. More...

 
double GetRating (const size_t user, const size_t item) const
 Return predicted rating given user ID and item ID. More...

 
void GetRatingOfUser (const size_t user, arma::vec &rating) const
 Get predicted ratings for a user. More...

 
const arma::mat & H () const
 Get the User Matrix. More...

 
const arma::sp_mat & ImplicitData () const
 Get Implicit Feedback Data. More...

 
double Lambda () const
 Get regularization parameter. More...

 
double & Lambda ()
 Modify regularization parameter. More...

 
size_t MaxIterations () const
 Get the number of iterations. More...

 
size_t & MaxIterations ()
 Modify the number of iterations. More...

 
const arma::vec & P () const
 Get the Item Bias Vector. More...

 
const arma::vec & Q () const
 Get the User Bias Vector. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialization. More...

 
const arma::mat & W () const
 Get the Item Matrix. More...

 
const arma::mat & Y () const
 Get the Item Implicit Matrix. More...

 

Detailed Description

Implementation of the SVDPlusPlus policy to act as a wrapper when accessing SVDPlusPlus from within CFType.

An example of how to use SVDPlusPlusPolicy in CF is shown below:

extern arma::mat data; // data is a (user, item, rating) table.
// Users for whom recommendations are generated.
extern arma::Col<size_t> users;
arma::Mat<size_t> recommendations; // Resulting recommendations.
CFType<SVDPlusPlusPolicy> cf(data);
// Generate 10 recommendations for all users.
cf.GetRecommendations(10, recommendations);

Definition at line 41 of file svdplusplus_method.hpp.

Constructor & Destructor Documentation

◆ SVDPlusPlusPolicy()

SVDPlusPlusPolicy ( const size_t  maxIterations = 10,
const double  alpha = 0.001,
const double  lambda = 0.1 
)
inline

Use SVDPlusPlus method to perform collaborative filtering.

Parameters
maxIterationsNumber of iterations.
alphaLearning rate for optimization.
lambdaRegularization parameter for optimization.

Definition at line 51 of file svdplusplus_method.hpp.

Member Function Documentation

◆ Alpha() [1/2]

double Alpha ( ) const
inline

Get learning rate.

Definition at line 193 of file svdplusplus_method.hpp.

◆ Alpha() [2/2]

double& Alpha ( )
inline

Modify learning rate.

Definition at line 195 of file svdplusplus_method.hpp.

◆ Apply()

void Apply ( const arma::mat &  data,
const arma::sp_mat &  ,
const size_t  rank,
const size_t  maxIterations,
const double  ,
const bool   
)
inline

Apply Collaborative Filtering to the provided data set using the svdplusplus.

Parameters
dataData matrix: dense matrix (coordinate lists) or sparse matrix(cleaned).
*(cleanedData) item user table in form of sparse matrix.
rankRank parameter for matrix factorization.
maxIterationsMaximum number of iterations.
*(minResidue) Residue required to terminate.
*(mit) Whether to terminate only when maxIterations is reached.

Definition at line 73 of file svdplusplus_method.hpp.

References SVDPlusPlus< OptimizerType >::Apply(), and SVDPlusPlus< OptimizerType >::CleanData().

◆ GetNeighborhood()

void GetNeighborhood ( const arma::Col< size_t > &  users,
const size_t  numUsersForSimilarity,
arma::Mat< size_t > &  neighborhood,
arma::mat &  similarities 
) const
inline

Get the neighborhood and corresponding similarities for a set of users.

Template Parameters
NeighborSearchPolicyThe policy to perform neighbor search.
Parameters
usersUsers whose neighborhood is to be computed.
numUsersForSimilarityThe number of neighbors returned for each user.
neighborhoodNeighbors represented by user IDs.
similaritiesSimilarity between each user and each of its neighbors.

Definition at line 157 of file svdplusplus_method.hpp.

◆ GetRating()

double GetRating ( const size_t  user,
const size_t  item 
) const
inline

Return predicted rating given user ID and item ID.

Parameters
userUser ID.
itemItem ID.

Definition at line 96 of file svdplusplus_method.hpp.

◆ GetRatingOfUser()

void GetRatingOfUser ( const size_t  user,
arma::vec &  rating 
) const
inline

Get predicted ratings for a user.

Parameters
userUser ID.
ratingResulting rating vector.

Definition at line 124 of file svdplusplus_method.hpp.

◆ H()

const arma::mat& H ( ) const
inline

Get the User Matrix.

Definition at line 177 of file svdplusplus_method.hpp.

◆ ImplicitData()

const arma::sp_mat& ImplicitData ( ) const
inline

Get Implicit Feedback Data.

Definition at line 185 of file svdplusplus_method.hpp.

◆ Lambda() [1/2]

double Lambda ( ) const
inline

Get regularization parameter.

Definition at line 198 of file svdplusplus_method.hpp.

◆ Lambda() [2/2]

double& Lambda ( )
inline

Modify regularization parameter.

Definition at line 200 of file svdplusplus_method.hpp.

◆ MaxIterations() [1/2]

size_t MaxIterations ( ) const
inline

Get the number of iterations.

Definition at line 188 of file svdplusplus_method.hpp.

◆ MaxIterations() [2/2]

size_t& MaxIterations ( )
inline

Modify the number of iterations.

Definition at line 190 of file svdplusplus_method.hpp.

◆ P()

const arma::vec& P ( ) const
inline

Get the Item Bias Vector.

Definition at line 181 of file svdplusplus_method.hpp.

◆ Q()

const arma::vec& Q ( ) const
inline

Get the User Bias Vector.

Definition at line 179 of file svdplusplus_method.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)
inline

Serialization.

Definition at line 206 of file svdplusplus_method.hpp.

◆ W()

const arma::mat& W ( ) const
inline

Get the Item Matrix.

Definition at line 175 of file svdplusplus_method.hpp.

◆ Y()

const arma::mat& Y ( ) const
inline

Get the Item Implicit Matrix.

Definition at line 183 of file svdplusplus_method.hpp.


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