AverageInterpolation Class Reference

This class performs average interpolation to generate interpolation weights for neighborhood-based collaborative filtering. More...

Public Member Functions

 AverageInterpolation ()
 
 AverageInterpolation (const arma::sp_mat &)
 This constructor is needed for interface consistency. More...

 
template
<
typename
VectorType
,
typename
DecompositionPolicy
>
void GetWeights (VectorType &&weights, const DecompositionPolicy &, const size_t, const arma::Col< size_t > &neighbors, const arma::vec &, const arma::sp_mat &)
 Interoplation weights are identical and sum up to one. More...

 

Detailed Description

This class performs average interpolation to generate interpolation weights for neighborhood-based collaborative filtering.

An example of how to use AverageInterpolation 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<> cf(data);
// Generate 10 recommendations for all users.
cf.template GetRecommendations<EuclideanSearch,
AverageInterpolation>(10, recommendations);

Definition at line 39 of file average_interpolation.hpp.

Constructor & Destructor Documentation

◆ AverageInterpolation() [1/2]

Definition at line 43 of file average_interpolation.hpp.

◆ AverageInterpolation() [2/2]

AverageInterpolation ( const arma::sp_mat &  )
inline

This constructor is needed for interface consistency.

Definition at line 48 of file average_interpolation.hpp.

Member Function Documentation

◆ GetWeights()

void GetWeights ( VectorType &&  weights,
const DecompositionPolicy &  ,
const size_t  ,
const arma::Col< size_t > &  neighbors,
const arma::vec &  ,
const arma::sp_mat &   
)
inline

Interoplation weights are identical and sum up to one.

After getting the weights, CF algorithm multiplies each neighbor's rating by its corresponding weight and sums them to get predicted rating.

Parameters
weightsResulting interpolation weights. The size of weights should be set to the number of neighbors before calling GetWeights().
*(decomposition) Decomposition object.
*(queryUser) Queried user.
neighborsNeighbors of queried user.
*(similarities) Similarites between query user and neighbors.
*(cleanedData) Sparse rating matrix.

Definition at line 65 of file average_interpolation.hpp.

References Log::Fatal.


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