ZScoreNormalization Class Reference

This normalization class performs z-score normalization on raw ratings. More...

Public Member Functions

 ZScoreNormalization ()
 
double Denormalize (const size_t, const size_t, const double rating) const
 Denormalize computed rating by adding mean and multiplying stddev. More...

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

 
double Mean () const
 Return mean. More...

 
void Normalize (arma::mat &data)
 Normalize the data to zero mean and one standard deviation. More...

 
void Normalize (arma::sp_mat &cleanedData)
 Normalize the data to zero mean and one standard deviation. More...

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

 
double Stddev () const
 Return stddev. More...

 

Detailed Description

This normalization class performs z-score normalization on raw ratings.

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

Definition at line 38 of file z_score_normalization.hpp.

Constructor & Destructor Documentation

◆ ZScoreNormalization()

ZScoreNormalization ( )
inline

Definition at line 42 of file z_score_normalization.hpp.

Member Function Documentation

◆ Denormalize() [1/2]

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

Denormalize computed rating by adding mean and multiplying stddev.

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

Definition at line 115 of file z_score_normalization.hpp.

◆ Denormalize() [2/2]

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

Denormalize computed rating by adding mean and multiplying stddev.

Parameters
*(combinations) User/Item combinations.
predictionsPredicted ratings for each user/item combination.

Definition at line 128 of file z_score_normalization.hpp.

◆ Mean()

double Mean ( ) const
inline

Return mean.

Definition at line 137 of file z_score_normalization.hpp.

◆ Normalize() [1/2]

void Normalize ( arma::mat &  data)
inline

Normalize the data to zero mean and one standard deviation.

Parameters
dataInput dataset in the form of coordinate list.

Definition at line 49 of file z_score_normalization.hpp.

References Log::Fatal.

◆ Normalize() [2/2]

void Normalize ( arma::sp_mat &  cleanedData)
inline

Normalize the data to zero mean and one standard deviation.

Parameters
cleanedDataInput data as a sparse matrix.

Definition at line 76 of file z_score_normalization.hpp.

References Log::Fatal.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)
inline

Serialization.

Definition at line 154 of file z_score_normalization.hpp.

◆ Stddev()

double Stddev ( ) const
inline

Return stddev.

Definition at line 145 of file z_score_normalization.hpp.


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