Find similar users
1. Manhattan Distance: Fast computing, very advantageous for Facebook to calculate the similarity between millions of users
The simplest way to calculate distance is Manhattan distance. In a two-dimensional model, everyone can be represented by dots (x, y), where I use subscripts to denote different people, (x1, y1) that Amy, (x2, y2) represents the mysterious Mr. X, then the distance between them is:
We can best recommend to Mr. X the results of the smallest results (distance closest).
2. Euclidean distance:
3. Minkowski Distance:
We can generalize the Manhattan distance and Euclidean distance into a formula called Minkowski distance:
which
r = 1The formula is the Manhattan distance
r = 2The formula is Euclidean distance.
r = ∞Maximum Distance
The larger the R value, the greater the difference in size of a single dimension will have on the overall distance.
4. Pearson correlation coefficient
Let's take a closer look at the user rating of the band and find that each user's scoring criteria are very different:
- Bill did not hit the extreme score, which was between 2 and 4 points;
- Jordyn seemed to like all the bands, scoring between 4 and 5;
- Hailey is an interesting person, his score is not 1 is 4.
So, how do you compare these users? For example, does the Hailey 4 point equal to Jordan's 4 points or 5 points? I think it's closer to 5 points. This will affect the accuracy of the referral system. One solution is to use Pearson correlation coefficients.
The Pearson correlation coefficient is calculated as:
Ability to calculate the approximate value of Pearson's correlation coefficients:
Data Mining 1-Introduction to recommended algorithms