Professional Documents
Culture Documents
Recommendation System
MR. U.A.NULI
2
Introduction:
When it comes to making decisions online about buying products, we read reviews about the
products from anonymous users, compare the products' specifications with other similar
products and then we make our decisions to buy or not.
In an online world, where information is growing at an exponential rate, looking for valid
information will be a challenge.
2
04-01-2021
3
Applications of Recommender systems:
4
Applications of Recommender systems:
4
04-01-2021
5
Applications of Recommender systems:
6
Applications of Recommender systems:
6
04-01-2021
7
Recommendation System Definition
If U = {users}, I = {items} then F = Objective function and measures the usefulness of item I to
user U, given by:
F :U X I → R
For each user u, we want to choose the item i that maximizes the objective function:
8
04-01-2021
The main goal of recommender systems is to provide relevant suggestions to online users
to make better decisions from many alternatives available over the Web.
10
Need for recommender systems
10
04-01-2021
11
Types of Recommender Systems
11
12
Neighbourhood-based recommendation engines:
Collaborative Filtering
12
04-01-2021
13
Neighbourhood-based recommendation engines:
13
14
Neighbourhood-based recommendation engines:
o People with similar preferences in the past have similar preferences in the future.
14
04-01-2021
15
Neighbourhood-based recommendation engines: Types
15
16
16
04-01-2021
17
Building basic recommendation engine:
17
18
User-based collaborative filtering
User based collaborative filtering first finds out the similarity between the active user ( the
user needing the recommendation) and other users.
Recommend the products that has not rated/purchased by active user but
rated/purchased by similar/ nearest users.
18
04-01-2021
19
Example: Movie Recommendation
Airlift 4 2
BhulBhulaiya 3 3 3 4
Hera Pheri 5 5 5 4
Welcome 3 4 4
Parmanu 4 4
19
Now assuming Sunil as active user, we will calculate distance of sunil with every other user
employing Euclidian distance formula. Here the movies for which no rating has been given 20
is assumed as 0.
20
04-01-2021
21
• The system suffers with performance if the user ratings are very sparse,
which is very common in the real world where users will rate only a few
items from a large catalog.
• The computing cost for calculating the similarity values for all the users is
very high if the data is very large.
• If user profiles or user inputs change quickly then we have to re-compute
the similarity values that come with a high computational cost
21
22
Item-based
collaborative filtering
item-based collaborative
filtering recommender systems,
unlike user-based collaborative
filtering, we use similarity
between items instead of
similarity between users.
22
04-01-2021
23
23
24
How to measure similarity between two items?
Mathematically, the cosine of the angle of between two vectors is derived from the
dot product of the two vectors divided by the product of the two vectors’ magnitude.
Mr. U.A.Nuli, Assistant Professor, Computer Science and Engineering Department
24
04-01-2021
25
Since we are finding the cosine of two vectors the output will always range from -1 to 1,
where -1 shows that two items are dissimilar and 1 shows that two items are completely
similar. We will now see how we can use the Cosine Similarity measure to determine how
similar the movies are.
Mr. U.A.Nuli, Assistant Professor, Computer Science and Engineering Department
25
26
Cosine Similarity
https://nickgrattandatascience.wordpress.com/2017/12/31/euclidean-manhattan-and-cosine-distance-measures-in-c/
Mr. U.A.Nuli, Assistant Professor, Computer Science and Engineering Department
26
04-01-2021
27
27
28
Cosine Similarity
28
04-01-2021
29
Example
Suppose we have movie ratings given by different users in a table format as shown below:
29
30
1. Create item-user table
Here user are considered as attributes/parameters to represent movies and can be used to find similarity.
30
04-01-2021
31
Step 2: To calculate the similarity between the movie Pulp Fiction (P) and Forrest Gump (F), we will
first find all the users who have rated both the movies. In our case, Calvin (C), Robert (R) and
Bradley (B) have rated the movies. We now create two vectors:
v1 = 5 C + 3 R + 1 B
v2 = 2 C + 3 R + 3 B
Therefore Cosine Similarity between movies Pulp Fiction and Forrest Gump is:
31
32
Similarly, we can calculate the cosine similarity of all the movies and our final similarity matrix will be:
32
04-01-2021
33
Step 3: Now we can predict and fill the ratings for a user for the items he hasn’t rated
yet. So to calculate the rating of user Amy for the movie Forrest Gump, we will use the
calculated similarity matrix along with the already rated movie by the user. Therefore,
the rating would be:
33
34
34
04-01-2021
35
Personalized recommendation engines:
Content-based recommender systems
Let's take the case of a person who has given a 4-star rating to a movie. In a collaborative
filtering approach we only consider this rating information for generating recommendations.
In real life, a person rates a movie based on the features or content of the movie such as its genre,
actor, director, story, and screenplay. Also the person watches a movie based on their personal
choices.
When we are building a recommendation engine to target users at a personal level, the
recommendations should not be based on the tastes of other similar people but should be based on
the individual users' tastes and the contents of the products.
Mr. U.A.Nuli, Assistant Professor, Computer Science and Engineering Department
35
36
When a new user comes, based on the preferences of the person we can suggest new
items that are similar to their tastes.
36
04-01-2021
37
37
38
38
04-01-2021
39
Limits of Recommendation systems
For all their efficiencies, Recommendation Systems are not a full proof system. Recommenders have
been known to suffer from the following limitations:
•Recommenders depend totally on data and their hirers must constantly supply them with large
volumes of data. That is why; smaller firms are more disadvantaged then the bigger firms such as
Google and Amazon.
•Recommenders may find it difficult to exactly identify user choice patterns if the user preferences
tend to vary quickly, as in fashion. Recommenders depend a lot on historic data but that may not be
suitable for certain product niches.
•Recommenders face problems with unpredictable items. For example, there are certain movie types
that evoke extreme reactions such as love or hate. It is extremely difficult to provide
recommendations for such items.
39