An implementation of the Pearson correlation. For users X and Y, the following values are calculated:
The correlation is then:
sumXY / sqrt(sumX2 * sumY2)
Note that this correlation "centers" its data, shifts the user's preference values so that each of their means is 0. This is necessary to achieve expected behavior on all data sets.
This correlation implementation is equivalent to the cosine measure correlation since the data it receives is assumed to be centered -- mean is 0. The correlation may be interpreted as the cosine of the angle between the two vectors defined by the users' preference values.
|
|