13 #ifndef MLPACK_METHODS_CF_CF_MODEL_HPP 14 #define MLPACK_METHODS_CF_CF_MODEL_HPP 39 AVERAGE_INTERPOLATION,
40 REGRESSION_INTERPOLATION,
41 SIMILARITY_INTERPOLATION
64 const arma::Mat<size_t>& combinations,
65 arma::vec& predictions) = 0;
72 arma::Mat<size_t>& recommendations) = 0;
79 arma::Mat<size_t>& recommendations,
80 const arma::Col<size_t>& users) = 0;
87 template<
typename DecompositionPolicy,
typename NormalizationPolicy>
100 const DecompositionPolicy& decomposition,
101 const size_t numUsersForSimilarity,
103 const size_t maxIterations,
104 const size_t minResidue,
108 numUsersForSimilarity,
124 CFModelType&
CF() {
return cf; }
129 const arma::Mat<size_t>& combinations,
130 arma::vec& predictions);
136 const size_t numRecs,
137 arma::Mat<size_t>& recommendations);
143 const size_t numRecs,
144 arma::Mat<size_t>& recommendations,
145 const arma::Col<size_t>& users);
148 template<
typename Archive>
165 enum DecompositionTypes
177 enum NormalizationTypes
180 ITEM_MEAN_NORMALIZATION,
181 USER_MEAN_NORMALIZATION,
182 OVERALL_MEAN_NORMALIZATION,
183 Z_SCORE_NORMALIZATION
188 DecompositionTypes decompositionType;
190 NormalizationTypes normalizationType;
224 return decompositionType;
229 return decompositionType;
235 return normalizationType;
240 return normalizationType;
245 const size_t numUsersForSimilarity,
247 const size_t maxIterations,
248 const double minResidue,
254 const arma::Mat<size_t>& combinations,
255 arma::vec& predictions);
260 const size_t numRecs,
261 arma::Mat<size_t>& recommendations,
262 const arma::Col<size_t>& users);
267 const size_t numRecs,
268 arma::Mat<size_t>& recommendations);
271 template<
typename Archive>
272 void serialize(Archive& ar,
const uint32_t );
CFModelType cf
This is the CF object that we are wrapping.
Definition: cf_model.hpp:156
CFWrapper(const arma::mat &data, const DecompositionPolicy &decomposition, const size_t numUsersForSimilarity, const size_t rank, const size_t maxIterations, const size_t minResidue, const bool mit)
Create the CFWrapper object, initializing the held CF object.
Definition: cf_model.hpp:99
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The CFWrapperBase class provides a unified interface that can be used by the CFModel class to interac...
Definition: cf_model.hpp:49
const NormalizationTypes & NormalizationType() const
Get the normalization type.
Definition: cf_model.hpp:233
CFWrapper()
Create the CFWrapper object, using default parameters to initialize the held CF object.
Definition: cf_model.hpp:96
void serialize(Archive &ar, const uint32_t)
Serialize the model.
Definition: cf_model.hpp:149
virtual ~CFWrapper()
Destroy the CFWrapper object.
Definition: cf_model.hpp:121
InterpolationTypes
InterpolationTypes contains the set of InterpolationPolicy classes that are usable by CFModel at pred...
Definition: cf_model.hpp:37
NeighborSearchTypes
NeighborSearchTypes contains the set of NeighborSearchPolicy classes that are usable by CFModel at pr...
Definition: cf_model.hpp:26
virtual CFWrapperBase * Clone() const =0
Make a copy of the object.
The model to save to disk.
Definition: cf_model.hpp:162
CFWrapperBase * CF() const
Get the CFWrapperBase object. (Be careful!)
Definition: cf_model.hpp:219
NormalizationTypes & NormalizationType()
Set the normalization type.
Definition: cf_model.hpp:238
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
Definition: hmm_train_main.cpp:300
const DecompositionTypes & DecompositionType() const
Get the decomposition type.
Definition: cf_model.hpp:222
CFWrapperBase()
Create the object. The base class has nothing to hold.
Definition: cf_model.hpp:53
virtual void Predict(const NeighborSearchTypes nsType, const InterpolationTypes interpolationType, const arma::Mat< size_t > &combinations, arma::vec &predictions)=0
Compute predictions for users.
virtual void GetRecommendations(const NeighborSearchTypes nsType, const InterpolationTypes interpolationType, const size_t numRecs, arma::Mat< size_t > &recommendations)=0
Compute recommendations for all users.
DecompositionTypes & DecompositionType()
Set the decomposition type.
Definition: cf_model.hpp:227
The CFWrapper class wraps the functionality of all CF types.
Definition: cf_model.hpp:88
virtual ~CFWrapperBase()
Delete the object.
Definition: cf_model.hpp:59
virtual CFWrapper * Clone() const
Clone the CFWrapper object. This handles polymorphism correctly.
Definition: cf_model.hpp:118
CFModelType & CF()
Get the CFType object.
Definition: cf_model.hpp:124