C# Class MyMediaLite.Correlation.Pearson

Shrunk Pearson correlation for rating data

The correlation values are shrunk towards zero, depending on the number of ratings the estimate is based on. Otherwise, we would give too much weight to similarities estimated from just a few examples.

http://en.wikipedia.org/wiki/Pearson_correlation

We apply shrinkage as in formula (5.16) of chapter 5 of the Recommender Systems Handbook. Note that the shrinkage formula has changed betweem the two publications. It is now based on the assumption that the true correlations are normally distributed; the shrunk estimate is the posterior mean of the empirical estimate.

Literature: Yehuda Koren: Factor in the Neighbors: Scalable and Accurate Collaborative Filtering, Transactions on Knowledge Discovery from Data (TKDD), 2009. http://public.research.att.com/~volinsky/netflix/factorizedNeighborhood.pdf Yehuda Koren, Robert Bell: Advances in Collaborative Filtering, Chapter 5 of the Recommender Systems Handbook, Springer, 2011. http://research.yahoo.net/files/korenBellChapterSpringer.pdf

Inheritance: RatingCorrelationMatrix
Mostrar archivo Open project: zenogantner/MyMediaLite Class Usage Examples

Public Methods

Method Description
ComputeCorrelation ( IRatings ratings, EntityType entity_type, float>.IList entity_ratings, int j ) : float
ComputeCorrelation ( IRatings ratings, EntityType entity_type, int i, int j ) : float
ComputeCorrelations ( IRatings ratings, EntityType entity_type ) : void
Pearson ( int num_entities, float shrinkage ) : System

Constructor. Create a Pearson correlation matrix

Protected Methods

Method Description
ComputeCorrelation ( double i_sum, double j_sum, double ii_sum, double jj_sum, double ij_sum, int n ) : float
GetDenominator ( double i_sum, double j_sum, double ii_sum, double jj_sum, int n ) : double
GetNumerator ( double i_sum, double j_sum, double ij_sum, int n ) : double

Method Details

ComputeCorrelation() public method

public ComputeCorrelation ( IRatings ratings, EntityType entity_type, float>.IList entity_ratings, int j ) : float
ratings IRatings
entity_type EntityType
entity_ratings float>.IList
j int
return float

ComputeCorrelation() public method

public ComputeCorrelation ( IRatings ratings, EntityType entity_type, int i, int j ) : float
ratings IRatings
entity_type EntityType
i int
j int
return float

ComputeCorrelation() protected method

protected ComputeCorrelation ( double i_sum, double j_sum, double ii_sum, double jj_sum, double ij_sum, int n ) : float
i_sum double
j_sum double
ii_sum double
jj_sum double
ij_sum double
n int
return float

ComputeCorrelations() public method

public ComputeCorrelations ( IRatings ratings, EntityType entity_type ) : void
ratings IRatings
entity_type EntityType
return void

GetDenominator() protected method

protected GetDenominator ( double i_sum, double j_sum, double ii_sum, double jj_sum, int n ) : double
i_sum double
j_sum double
ii_sum double
jj_sum double
n int
return double

GetNumerator() protected method

protected GetNumerator ( double i_sum, double j_sum, double ij_sum, int n ) : double
i_sum double
j_sum double
ij_sum double
n int
return double

Pearson() public method

Constructor. Create a Pearson correlation matrix
public Pearson ( int num_entities, float shrinkage ) : System
num_entities int the number of entities
shrinkage float shrinkage parameter
return System