13 #ifndef MLPACK_METHODS_CF_CF_MODEL_HPP 14 #define MLPACK_METHODS_CF_CF_MODEL_HPP 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>
183 Z_SCORE_NORMALIZATION
224 return decompositionType;
229 return decompositionType;
235 return normalizationType;
240 return normalizationType;
244 void Train(
const arma::mat& data,
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 );
279 #include "cf_model_impl.hpp"
CFWrapperBase()
Create the object. The base class has nothing to hold.
Linear algebra utility functions, generally performed on matrices or vectors.
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.
The CFWrapperBase class provides a unified interface that can be used by the CFModel class to interac...
CFWrapperBase * CF() const
Get the CFWrapperBase object. (Be careful!)
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.
NormalizationTypes & NormalizationType()
Set the normalization type.
CFModelType cf
This is the CF object that we are wrapping.
virtual CFWrapper * Clone() const
Clone the CFWrapper object. This handles polymorphism correctly.
The model to save to disk.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
CFWrapper()
Create the CFWrapper object, using default parameters to initialize the held CF object.
InterpolationTypes
InterpolationTypes contains the set of InterpolationPolicy classes that are usable by CFModel at pred...
const NormalizationTypes & NormalizationType() const
Get the normalization type.
virtual CFWrapperBase * Clone() const =0
Make a copy of the object.
virtual ~CFWrapperBase()
Delete the object.
void serialize(Archive &ar, const uint32_t)
Serialize the model.
NeighborSearchTypes
NeighborSearchTypes contains the set of NeighborSearchPolicy classes that are usable by CFModel at pr...
virtual ~CFWrapper()
Destroy the CFWrapper object.
The CFWrapper class wraps the functionality of all CF types.
virtual void Predict(const NeighborSearchTypes nsType, const InterpolationTypes interpolationType, const arma::Mat< size_t > &combinations, arma::vec &predictions)=0
Compute predictions for users.
const DecompositionTypes & DecompositionType() const
Get the decomposition type.
CFModelType & CF()
Get the CFType object.
CFType< DecompositionPolicy, NormalizationPolicy > CFModelType