RegressionInterpolation Class Reference

Implementation of regression-based interpolation method. More...

Public Member Functions

 RegressionInterpolation ()
 Empty Constructor. More...

 
 RegressionInterpolation (const arma::sp_mat &cleanedData)
 Use cleanedData to perform necessary preprocessing. More...

 
template
<
typename
VectorType
,
typename
DecompositionPolicy
>
void GetWeights (VectorType &&weights, const DecompositionPolicy &decomposition, const size_t queryUser, const arma::Col< size_t > &neighbors, const arma::vec &, const arma::sp_mat &cleanedData)
 The regression-based interpolation problem can be solved by a linear system of equations. More...

 

Detailed Description

Implementation of regression-based interpolation method.

Predicting a user's rating $ r_{iu} $ by it's neighbors' ratings can be regarded as solving linear regression of $ r_{iu} $ on $ r_{iv} $, where v are u's neighbors.

An example of how to use RegressionInterpolation 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<
RegressionInterpolation>(10, recommendations);

For more information, see the following paper.

@inproceedings{bell2007improved,
title={Improved neighborhood-based collaborative filtering},
author={Bell, Robert M and Koren, Yehuda},
booktitle={KDD cup and workshop at the 13th ACM SIGKDD international
conference on knowledge discovery and data mining},
pages={7--14},
year={2007},
organization={Citeseer}
}

Definition at line 56 of file regression_interpolation.hpp.

Constructor & Destructor Documentation

◆ RegressionInterpolation() [1/2]

Empty Constructor.

Definition at line 62 of file regression_interpolation.hpp.

◆ RegressionInterpolation() [2/2]

RegressionInterpolation ( const arma::sp_mat &  cleanedData)
inline

Use cleanedData to perform necessary preprocessing.

Parameters
cleanedDataSparse rating matrix.

Definition at line 69 of file regression_interpolation.hpp.

Member Function Documentation

◆ GetWeights()

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

The regression-based interpolation problem can be solved by a linear system of equations.

This method first calculates the coefficients and constant terms for the equations and then solve the equations. The solution of the linear system of equations is the resulting interpolation weights (the first parameter). 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().
decompositionDecomposition object.
queryUserQueried user.
neighborsNeighbors of queried user.
*(similarities) Similarities between query user and neighbors.
cleanedDataSparse rating matrix.

Definition at line 95 of file regression_interpolation.hpp.

References Log::Fatal.


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