25 #ifndef __MLPACK_METHODS_CF_CF_HPP
26 #define __MLPACK_METHODS_CF_CF_HPP
91 const size_t rank = 0);
98 Log::Warn <<
"CF::NumUsersForSimilarity(): invalid value (< 1) "
99 "ignored." << std::endl;
112 void Rank(
const size_t rankValue)
114 this->
rank = rankValue;
130 const arma::mat&
W()
const {
return w; }
132 const arma::mat&
H()
const {
return h; }
147 arma::Mat<size_t>& recommendations);
157 arma::Mat<size_t>& recommendations,
158 arma::Col<size_t>& users);
196 const size_t neighbor,
198 arma::Mat<size_t>& recommendations,
199 arma::mat& values)
const;
207 #include "cf_impl.hpp"
std::string ToString() const
Returns a string representation of this object.
This class implements AMF (alternating matrix factorization) on the given matrix V.
Linear algebra utility functions, generally performed on matrices or vectors.
arma::mat rating
Rating matrix.
FactorizerType factorizer
Instantiated factorizer object.
CF(arma::mat &data, const size_t numUsersForSimilarity=5, const size_t rank=0)
Initialize the CF object.
void InsertNeighbor(const size_t queryIndex, const size_t pos, const size_t neighbor, const double value, arma::Mat< size_t > &recommendations, arma::mat &values) const
Helper function to insert a point into the recommendation matrices.
This class implements a simple residue-based termination policy.
const arma::mat & Data() const
Get the data matrix.
size_t rank
Rank used for matrix factorization.
void GetRecommendations(const size_t numRecs, arma::Mat< size_t > &recommendations)
Generates the given number of recommendations for all users.
void Rank(const size_t rankValue)
Sets rank parameter for matrix factorization.
const arma::mat & Rating() const
Get the Rating Matrix.
This class implements a method titled 'Alternating Least Squares' described in the paper 'Positive Ma...
size_t numUsersForSimilarity
Number of users for similarity.
void NumUsersForSimilarity(const size_t num)
Sets number of users for calculating similarity.
size_t NumUsersForSimilarity() const
Gets number of users for calculating similarity.
const arma::mat & H() const
Get the Item Matrix.
const arma::mat & W() const
Get the User Matrix.
void Factorizer(const FactorizerType &f)
Sets factorizer for NMF.
arma::mat data
Initial data matrix.
size_t Rank() const
Gets rank parameter for matrix factorization.
const arma::sp_mat & CleanedData() const
Get the cleaned data matrix.
static util::PrefixedOutStream Warn
Prints warning messages prefixed with [WARN ].
arma::sp_mat cleanedData
Cleaned data matrix.
This class implements Collaborative Filtering (CF).
void CleanData()
Converts the User, Item, Value Matrix to User-Item Table.