mlpack
Public Types | Public Member Functions | List of all members
mlpack::cf::CombinedNormalization< NormalizationTypes > Class Template Reference

This normalization class performs a sequence of normalization methods on raw ratings. More...

#include <combined_normalization.hpp>

Public Types

using TupleType = std::tuple< NormalizationTypes... >
 

Public Member Functions

template<typename MatType >
void Normalize (MatType &data)
 Normalize the data by calling Normalize() in each normalization object. More...
 
double Denormalize (const size_t user, const size_t item, const double rating) const
 Denormalize rating by calling Denormalize() in each normalization object. More...
 
void Denormalize (const arma::Mat< size_t > &combinations, arma::vec &predictions) const
 Denormalize rating by calling Denormalize() in each normalization object. More...
 
const TupleType & Normalizations () const
 Return normalizations tuple.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t version)
 Serialization.
 

Detailed Description

template<typename... NormalizationTypes>
class mlpack::cf::CombinedNormalization< NormalizationTypes >

This normalization class performs a sequence of normalization methods on raw ratings.

An example of how to use CombinedNormalization 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<NMFPolicy,
CombinedNormalization<
OverallMeanNormalization,
UserMeanNormalization,
ItemMeanNormalization>> cf(data);
// Generate 10 recommendations for all users.
cf.GetRecommendations(10, recommendations);

Member Function Documentation

◆ Denormalize() [1/2]

template<typename... NormalizationTypes>
double mlpack::cf::CombinedNormalization< NormalizationTypes >::Denormalize ( const size_t  user,
const size_t  item,
const double  rating 
) const
inline

Denormalize rating by calling Denormalize() in each normalization object.

Note that the order of objects calling Denormalize() should be the reversed order of objects calling Normalize().

Parameters
userUser ID.
itemItem ID.
ratingComputed rating before denormalization.

◆ Denormalize() [2/2]

template<typename... NormalizationTypes>
void mlpack::cf::CombinedNormalization< NormalizationTypes >::Denormalize ( const arma::Mat< size_t > &  combinations,
arma::vec &  predictions 
) const
inline

Denormalize rating by calling Denormalize() in each normalization object.

Note that the order of objects calling Denormalize() should be the reversed order of objects calling Normalize().

Parameters
combinationsUser/Item combinations.
predictionsPredicted ratings for each user/item combination.

◆ Normalize()

template<typename... NormalizationTypes>
template<typename MatType >
void mlpack::cf::CombinedNormalization< NormalizationTypes >::Normalize ( MatType &  data)
inline

Normalize the data by calling Normalize() in each normalization object.

Parameters
dataInput dataset.

The documentation for this class was generated from the following file: