ItemMeanNormalization Class Reference

This normalization class performs item mean normalization on raw ratings. More...

Public Member Functions

 ItemMeanNormalization ()
 
double Denormalize (const size_t, const size_t item, const double rating) const
 Denormalize computed rating by adding item mean. More...

 
void Denormalize (const arma::Mat< size_t > &combinations, arma::vec &predictions) const
 Denormalize computed rating by adding item mean. More...

 
const arma::vec & Mean () const
 Return item mean. More...

 
void Normalize (arma::mat &data)
 Normalize the data by subtracting item mean from each of existing ratings. More...

 
void Normalize (arma::sp_mat &cleanedData)
 Normalize the data by subtracting item mean from each of existing ratings. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialization. More...

 

Detailed Description

This normalization class performs item mean normalization on raw ratings.

An example of how to use ItemMeanNormalization 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.
// Use ItemMeanNormalization as normalization method.
CFType<NMFPolicy, ItemMeanNormalization> cf(data);
// Generate 10 recommendations for all users.
cf.GetRecommendations(10, recommendations);

Definition at line 39 of file item_mean_normalization.hpp.

Constructor & Destructor Documentation

◆ ItemMeanNormalization()

Definition at line 43 of file item_mean_normalization.hpp.

Member Function Documentation

◆ Denormalize() [1/2]

double Denormalize ( const size_t  ,
const size_t  item,
const double  rating 
) const
inline

Denormalize computed rating by adding item mean.

Parameters
*(user) User ID.
itemItem ID.
ratingComputed rating before denormalization.

Definition at line 130 of file item_mean_normalization.hpp.

◆ Denormalize() [2/2]

void Denormalize ( const arma::Mat< size_t > &  combinations,
arma::vec &  predictions 
) const
inline

Denormalize computed rating by adding item mean.

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

Definition at line 143 of file item_mean_normalization.hpp.

◆ Mean()

const arma::vec& Mean ( ) const
inline

Return item mean.

Definition at line 156 of file item_mean_normalization.hpp.

◆ Normalize() [1/2]

void Normalize ( arma::mat &  data)
inline

Normalize the data by subtracting item mean from each of existing ratings.

Parameters
dataInput dataset in the form of coordinate list.

Definition at line 50 of file item_mean_normalization.hpp.

◆ Normalize() [2/2]

void Normalize ( arma::sp_mat &  cleanedData)
inline

Normalize the data by subtracting item mean from each of existing ratings.

Parameters
cleanedDataInput data as a sparse matrix.

Definition at line 90 of file item_mean_normalization.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)
inline

Serialization.

Definition at line 162 of file item_mean_normalization.hpp.


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