Implementation of the Randomized SVD policy to act as a wrapper when accessing Randomized SVD from within CFType.
More...
#include <randomized_svd_method.hpp>
|
| | RandomizedSVDPolicy (const size_t iteratedPower=0, const size_t maxIterations=2) |
| | Use randomized SVD method to perform collaborative filtering. More...
|
| |
| template<typename MatType > |
| void | Apply (const MatType &, const arma::sp_mat &cleanedData, const size_t rank, const size_t maxIterations, const double, const bool) |
| | Apply Collaborative Filtering to the provided data set using the randomized SVD. 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...
|
| |
| size_t & | IteratedPower () |
| | Modify the size of the normalized power iterations. More...
|
| |
| size_t | IteratedPower () const |
| | Get the size of the normalized power iterations. More...
|
| |
| size_t & | MaxIterations () |
| | Modify the number of iterations. More...
|
| |
| size_t | MaxIterations () const |
| | Get the number of iterations. More...
|
| |
| template<typename Archive > |
| void | serialize (Archive &ar, const unsigned int) |
| | Serialization. More...
|
| |
| const arma::mat & | W () const |
| | Get the Item Matrix. More...
|
| |
Implementation of the Randomized SVD policy to act as a wrapper when accessing Randomized SVD from within CFType.
An example of how to use RandomizedSVDPolicy in CF is shown below:
extern arma::mat data;
extern arma::Col<size_t> users;
arma::Mat<size_t> recommendations;
cf.GetRecommendations(10, recommendations);
This class implements Collaborative Filtering (CF).
Definition at line 41 of file randomized_svd_method.hpp.
◆ RandomizedSVDPolicy()
Use randomized SVD method to perform collaborative filtering.
- Parameters
-
| iteratedPower | Size of the normalized power iterations (Default: rank + 2). |
| maxIterations | Number of iterations for the power method (Default: 2). |
Definition at line 52 of file randomized_svd_method.hpp.
◆ Apply()
| void Apply |
( |
const MatType & |
, |
|
|
const arma::sp_mat & |
cleanedData, |
|
|
const size_t |
rank, |
|
|
const size_t |
maxIterations, |
|
|
const double |
, |
|
|
const bool |
|
|
) |
| |
|
inline |
Apply Collaborative Filtering to the provided data set using the randomized SVD.
- Parameters
-
| * | (data) Data matrix: dense matrix (coordinate lists) or sparse matrix(cleaned). |
| cleanedData | item user table in form of sparse matrix. |
| rank | Rank parameter for matrix factorization. |
| maxIterations | Maximum number of iterations. |
| * | (minResidue) Residue required to terminate. |
| * | (mit) Whether to terminate only when maxIterations is reached. |
Definition at line 73 of file randomized_svd_method.hpp.
References RandomizedSVD::Apply().
◆ 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
-
| NeighborSearchPolicy | The policy to perform neighbor search. |
- Parameters
-
| users | Users whose neighborhood is to be computed. |
| numUsersForSimilarity | The number of neighbors returned for each user. |
| neighborhood | Neighbors represented by user IDs. |
| similarities | Similarity between each user and each of its neighbors. |
Definition at line 129 of file randomized_svd_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
-
| user | User ID. |
| item | Item ID. |
Definition at line 99 of file randomized_svd_method.hpp.
◆ GetRatingOfUser()
| void GetRatingOfUser |
( |
const size_t |
user, |
|
|
arma::vec & |
rating |
|
) |
| const |
|
inline |
Get predicted ratings for a user.
- Parameters
-
| user | User ID. |
| rating | Resulting rating vector. |
Definition at line 111 of file randomized_svd_method.hpp.
◆ H()
| const arma::mat & H |
( |
| ) |
const |
|
inline |
◆ IteratedPower() [1/2]
| size_t & IteratedPower |
( |
| ) |
|
|
inline |
◆ IteratedPower() [2/2]
| size_t IteratedPower |
( |
| ) |
const |
|
inline |
◆ MaxIterations() [1/2]
| size_t & MaxIterations |
( |
| ) |
|
|
inline |
◆ MaxIterations() [2/2]
| size_t MaxIterations |
( |
| ) |
const |
|
inline |
◆ serialize()
| void serialize |
( |
Archive & |
ar, |
|
|
const unsigned int |
|
|
) |
| |
|
inline |
◆ W()
| const arma::mat & W |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: