P1: Trim: 6.125in×9.25in Top: 0.5in Gutter: 0.75in
CUUS2079-09 CUUS2079-Zafarani 978 1 107 01885 3 January 13, 2014 17:28
262 Recommendation in Social Media
Table 9.4.User-Item Matrix
Lion King Aladdin Mulan Anastasia
John 4 3 2 2
Joe 5 2 1 5
Jill 2 5? 0
Jane 1 3 4 3
Jorge 3 1 1 2
Example 9.5.Consider the user-item matrix in Table9.4and the following
adjacency matrix denoting the friendship among these individuals.
A=
⎡
⎢⎢
⎢⎢
⎢⎢
⎢
⎣
John Joe Jill Jane Jorge
John 0100 1
Joe 1010 0
Jill 0101 1
Jane 0010 0
Jorge 1010 0
⎤
⎥⎥
⎥⎥
⎥⎥
⎥
⎦
, (9.57)
We wish to predict rJill,Mulan. We compute the average ratings and simi-
larity between Jill and other individuals using cosine similarity:
r ̄John=
4 + 3 + 2 + 2
4
= 2. 75. (9.58)
r ̄Joe=
5 + 2 + 1 + 5
4
= 3. 25. (9.59)
r ̄Jill=
2 + 5 + 0
3
= 2. 33. (9.60)
r ̄Jane=
1 + 3 + 4 + 3
4
= 2. 75. (9.61)
r ̄Jorge=
3 + 1 + 1 + 2
4
= 1. 75. (9.62)
The similarities are
sim(Jill,John)=
2 × 4 + 5 × 3 + 0 × 2
√
29
√
29
= 0. 79. (9.63)
sim(Jill,Joe)=
2 × 5 + 5 × 2 + 0 × 5
√
29
√
54
= 0. 50. (9.64)
sim(Jill,Jane)=
2 × 1 + 5 × 3 + 0 × 3
√
29
√
19
= 0. 72. (9.65)
sim(Jill,Jorge)=