Tutorial 4
E-commerce
GE2338 Internet Applications and Security
Q1: Cosine-based similarity (1/2)
Given the rating matrix with n users and m items as below, find out the
missing similarity values.
item pj
1 2 3 4 5
1 0 4 2 2 0
2 0 3 0 3 0
user ui
3 4 1 3 0 5
4 3 0 0 0 4
GE2338 © 2018 By Dr. Chi-Yin Chow 2
Q1: Cosine-based similarity (2/2)
Similarity matrix
1 2 3 4 5
1 - 0.16 0.67 0.00 ?
2 0.16 - 0.60 ? 0.15
3 0.67 0.60 - 0.31 0.65
4 0.00 ? 0.31 - 0.00
5 ? 0.15 0.65 0.00 -
GE2338 © 2018 By Dr. Chi-Yin Chow 3
Q1: Cosine-based similarity (Answer)
Similarity matrix
1 2 3 4 5
1 - 0.16 0.67 0.00 1.00
2 0.16 - 0.60 0.92 0.15
3 0.67 0.60 - 0.31 0.65
4 0.00 0.92 0.31 - 0.00
5 1.00 0.15 0.65 0.00 -
GE2338 © 2018 By Dr. Chi-Yin Chow 4
Q2: Rating Prediction
Predict the rating for user u4 on items p2, p3 and p4.
GE2338 © 2018 By Dr. Chi-Yin Chow 5
Q2: Rating Prediction (Answer) (1/2)
product 2
product 3 is higher
GE2338 © 2018 By Dr. Chi-Yin Chow 6
Q2: Rating Prediction (Answer) (2/2)
GE2338 © 2018 By Dr. Chi-Yin Chow 7
Q3: Recommendation
Recommend top-2 items to u4.
Answer: p2 and p3.
GE2338 © 2018 By Dr. Chi-Yin Chow 8
1.08
0.16+0.6+0.925
+0.15