Recommendation system is aim to recommend some items to user. It can be devided into:
- User-based collaborative filtering
- Item-based collaborative filtering
We use kNN to find the similar users/items.
Based on data, we will calculate the similarity among users/items for kNN by:
- Jaccard similarity
- Euclidean distance
- Manhattan distance
- Minkowski distance
- Cosine similarity
All of those measure methods were implemented in python (measure.py).
We have a user-drink ratings matrix M below, where 6 users (rows) have rated 6 drink type (columns). Ratings can take up integer values from 1–10 and 0 indicates absence of rating. Now we have to decide that we should recommend coffee to user 2 (currently he is active user) or not. Assuming that user 2 will only like coffee if his rate is greater or equal to 5.
This problem can be resolved by 2 ways:
- User-based collaborative filtering:
-
Using kNN to find k most similar user with action user.
-
In order to predict the coffee rate of active user, we use the function:
Where:
- r(x,s) is the prediction for active user x for item s
- r(x) is the average rating of user x
- r(y,s) is rate of user y with item s
- sim(x,y) is the similarity between users a and u
- S(xy) is the neighborhood of most similar users.
- Item-based collaborative filtering:
- Using kNN to find k most similar items with coffee.
- Calculate average of active user's rating with other drink type. This will be rate of active user with coffee.
This example will be solved in coffee-recommend.py


