# User CF itemcf collaborative filtering algorithm based on user and item

UserCF:
weight coefficient: the similarity between all non-target users and Target users, normalized (that is, the sum is 1).
calculates the score of the ith item by multiplying the score of the Target item by the weight factor of the non-target user.
considering that some users like high score and some like low score, decentralization + centralization strategy is often adopted.

1 2 3 4 5
A 10 9 9 8 10
B 7 4

6 6 5
C 10 7 10 10 10
D 10 9 7 7 9
E 6<10/td>

7

8

?

For here

S

E

.

5

S_{E,5}

SE, the value of 5:
1. Calculate the similarity of user 1-4 and 5 (use the value of goods A-> D);
2. Normalization of similarity, that is, the sum of 4 similarities is 1; 3. The ith similarity times (the ith user’s rating of item E – the ith user’s average rating of all items) (decentralize), sum the four results, and add the average rating of Target user (centralize). I = 1, 2, 3, 4.
ItemCF:
weight coefficient: similarity of non-target goods, and normalized (making the sum 1);
then multiply each non-target user’s rating of the Target product by the weight coefficient to get the Target user’s rating.
Ditto for

S

E

.

5

S_{E,5}

The value of SE,5:
1. Calculate the similarity of goods a-d and E (using 1-4 users with ratings);
2. Normalization of similarity coefficient; 3. The ith similarity multiplied by (user 5’s score for item j – user 5’s average score for all items) (decentralize), sum the four results, plus the average score for item E from user 1-4 (centralize). Ibid., j=A,B,C,D.