0% found this document useful (0 votes)
4 views31 pages

Non_Collaborative_Filtering

The document discusses collaborative filtering for recommender systems, explaining user-based and item-based filtering, as well as similarity measures. It covers the concepts of recommender systems, association rules, user ratings, and the importance of personalized recommendations. The document also details the processes of predicting ratings and the differences between user-based and item-based collaborative filtering.

Uploaded by

Tejas S Trivedi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views31 pages

Non_Collaborative_Filtering

The document discusses collaborative filtering for recommender systems, explaining user-based and item-based filtering, as well as similarity measures. It covers the concepts of recommender systems, association rules, user ratings, and the importance of personalized recommendations. The document also details the processes of predicting ratings and the differences between user-based and item-based collaborative filtering.

Uploaded by

Tejas S Trivedi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Collaborative Filtering

for Recommender Systems

User-Based & Item-Based Filtering, Similarity Measures, and Worked Prediction Examples

(Note: PCA and Matrix Factorization are intentionally not covered here)
1. What Is a Recommender System?
A recommender system is a system that suggests suitable items to users based on their interests, behaviour, or
previous choices.

The word item may mean:


● A movie on Netflix
● A product on Amazon
● A song on Spotify
● A video on YouTube
● A course on an education website
● A news article on a news application

Example
Suppose Riya watches and likes several comedy movies. The system may recommend another comedy movie
that she has not watched.

The objective is:


Recommend the right item to the right user.
2. Association Rules
Association rules identify items that frequently occur together. They answer questions such as:
If a customer buys item X, how likely are they to buy item Y?

An association rule is written as:

X→Y
It means: if X occurs, Y is also likely to occur.

Example
Suppose supermarket transactions show that many customers who buy diapers also buy baby powder. The rule
can be written as:

{Diapers} → {Baby Powder}


The supermarket may therefore recommend baby powder to a customer who adds diapers to their shopping
cart.

Transaction-Itemset Model
Association rules generally use transaction data.

Transaction Items Purchased


T1 Bread, Milk
T2 Bread, Butter
T3 Bread, Milk, Butter
T4 Milk, Butter

Each row represents one transaction, while the products form its itemset.

Important Measures
Support — how frequently X and Y occur together.

Support(X → Y) = (Transactions with both X and Y) / (Total transactions)


For Bread → Milk: Bread and Milk occur together in T1 and T3, total transactions = 4.

Support = 2 / 4 = 0.50 (50%)


Confidence — how often Y is purchased when X is purchased.

Confidence(X → Y) = Support(X ∩ Y) / Support(X)


Bread appears in three transactions, and Bread with Milk appears in two.
Confidence(Bread → Milk) = 2 / 3 = 66.67%
Lift — checks whether the relationship is stronger than ordinary chance.

Lift(X → Y) = Confidence(X → Y) / Support(Y)


● Lift greater than 1: positive relationship
● Lift equal to 1: no special relationship
● Lift less than 1: negative relationship

Limitation of Association Rules


Association rules usually provide general recommendations. They do not fully consider the individual taste of
every user.

For example, every person buying a mobile phone might receive the same recommendation for a phone cover.
This is why personalized recommender systems are needed.
Personalized Recommendations
A personalized recommendation is created separately for a particular user.

Example
Suppose two users open the same shopping website:
● User A frequently buys sports products.
● User B frequently buys books.
The website should show sports-related recommendations to User A and book recommendations to User B. The
recommendations are different because their preferences are different.
3. User Ratings
Recommender systems learn user interests from ratings. A rating is not always a numerical score. It can be
explicit or implicit.

3.1 Explicit Ratings


An explicit rating is directly provided by the user. Examples include:
● Giving a movie 4 out of 5 stars
● Clicking a Like or Dislike button
● Writing a product review
● Buying a product
● Selecting a favourite song

Example
User Movie Rating
Amit Titanic 5
Amit Batman 3
Neha Titanic 4
Neha Batman 2

The users have directly expressed their opinions.

3.2 Implicit Ratings


An implicit rating is inferred from user behaviour. Examples include:
● Time spent watching a video
● Number of clicks on a product
● Repeatedly listening to a song
● Searching for a particular item
● Adding an item to a wish list
● Scrolling through an article

Example
Suppose Rahul does not rate a video but watches it completely three times. The system may infer that Rahul
likes the video.
Limitation
Implicit behaviour does not always indicate liking. For example, a user may repeatedly open a product page only
to compare its price, not because they like the product.
4. Collaborative Filtering
Collaborative filtering produces recommendations using the collective behaviour of many users. Its basic idea is:
People who agreed in the past are likely to agree again in the future.

Collaborative filtering normally does not require detailed information about an item. It mainly uses ratings or
user behaviour.

Example
Suppose Asha likes Titanic and The Notebook. Meera also likes Titanic and The Notebook, and Meera
additionally likes La La Land.

Since Asha and Meera have similar preferences, the system may recommend La La Land to Asha.
5. User-Rating Matrix
Collaborative filtering uses a user-rating matrix:
● Rows represent users.
● Columns represent items.
● Cells contain ratings.
● Missing cells represent items that have not been rated.

Example
User Titanic Batman Inception Superman
Amit 5 2 ? 1
Neha 4 1 5 ?
Ravi 1 5 4 5
Priya 5 2 4 ?

The question marks indicate missing ratings. The recommender system tries to predict these values. For
example, it may predict Amit's rating for Inception as 4.5. Because the predicted rating is high, Inception can be
recommended to Amit.
6. Sparse Matrix
A user-rating matrix is generally sparse, meaning most cells are empty.

Example
An online shopping platform may contain 1,000,000 users and 100,000 products. However, an average user
might rate only 10 products. Therefore, almost all values in the matrix will be missing.

Why Is Sparsity a Problem?


When users have rated very few common items, it becomes difficult to determine whether they have similar
preferences.

For example: User A has rated 20 films, User B has rated 25 films, and they have only one film in common. One
shared rating is usually insufficient to confidently conclude that they are similar.
7. Completing the User's Row
For a particular user, collaborative filtering predicts the missing values in that user's row.

Consider Amit's row:

User Titanic Batman Inception Superman


Amit 5 2 ? 1

The system predicts Amit's rating for Inception using ratings from similar users. If the predicted rating is:

ŕ(Amit, Inception) = 4.6


then Inception can be recommended to Amit. The symbol ŕ means a predicted rating.
8. User-Based Collaborative Filtering (UBCF)
User-Based Collaborative Filtering finds users with similar preferences. Its principle is:
If User A and User B liked similar items in the past, an item liked by User B may also be liked by User A.

Main Steps
● Select the target user.
● Compare the target user with other users.
● Identify the most similar users, called neighbours.
● Find items liked by those neighbours.
● Predict the target user's missing ratings.
● Recommend items having high predicted ratings.

Example
User Titanic Batman Inception
Amit 5 2 ?
Neha 4 2 5
Ravi 1 5 2

Amit and Neha have similar ratings — both gave Titanic a high rating and both gave Batman a low rating.
Therefore, Neha is a suitable neighbour for Amit.

Because Neha gave Inception a rating of 5, the system may recommend Inception to Amit.
9. Measuring User Similarity
To apply UBCF, we must calculate how similar two users are. The main approaches are Pearson correlation,
mean-centred cosine similarity, and significance weighting.

9.1 Pearson Correlation


Pearson correlation measures whether two users follow a similar rating pattern. Its value normally lies between
-1 and +1.

Pearson Value Meaning


+1 Completely similar pattern
Close to +1 Strongly similar
0 No clear relationship
Close to -1 Opposite preferences
-1 Completely opposite pattern

Why Is the Mean Removed?


Different users may use rating scales differently. For example, User A usually gives ratings between 4 and 5,
while User B usually gives ratings between 2 and 4. Even if their absolute ratings differ, they may prefer and
dislike the same items.

Pearson correlation compares how each rating differs from that user's average rating.

Formula
w(u,i) = Σ[(r(u,j) - r̄u)(r(i,j) - r̄i)] / [√Σ(r(u,j) - r̄u)² × √Σ(r(i,j) - r̄i)²]
Where:
● w(u,i) = similarity between users u and i
● r(u,j) = rating given by user u to item j
● r(i,j) = rating given by user i to item j
● r̄u = average rating of user u
● r̄i = average rating of user i
● I(ui) = items rated by both users

Simple Example
Movie User A User B
M1 5 4
M2 3 2
M3 4 3
User B consistently gives one point less than User A, but both follow exactly the same preference pattern: M1 is
their favourite, M3 comes second, and M2 is their least favourite.

Their Pearson correlation is:

1
Therefore, their preferences are considered perfectly similar.

9.2 Problem with Pearson Correlation


Pearson generally considers only items rated by both users. This can produce an unreliable result when users
have very few common ratings.

Example
Suppose User A has rated 50 movies, User B has rated 60 movies, only two movies are common, and their
ratings for those two movies are identical. Pearson correlation may produce a similarity close to 1. However, two
common movies are not enough to confidently say that the users have the same taste.
High similarity does not always mean reliable similarity. The number of common ratings must also be
considered.

9.3 Cosine Similarity


Cosine similarity measures the angle between two rating vectors.

Cosine(A, B) = (A · B) / (|A| |B|)


Its common interpretation is:
● Close to 1: highly similar
● Close to 0: not similar
● Negative value: opposite direction when mean-centred values are used

Basic Example
A = (5, 4, 1) B = (4, 5, 1)
The two users give high ratings to the first two items and a low rating to the third. Therefore, the vectors point
in similar directions and their cosine similarity will be high.

9.4 Mean-Centred Cosine Similarity


In mean-centred cosine similarity, each user's average rating is subtracted from their individual ratings.

r'(u,j) = r(u,j) - r̄u


Then cosine similarity is calculated using these adjusted values.
Example
User A's ratings: (5, 3, 4), average = (5+3+4)/3 = 4

Mean-centred ratings: (5-4, 3-4, 4-4) = (1, -1, 0)

User B's ratings: (4, 2, 3), average = 3

Mean-centred ratings: (4-3, 2-3, 3-3) = (1, -1, 0)

The adjusted vectors are identical. Therefore, their similarity is 1. This correctly recognises that the users have
the same preference pattern even though User B generally gives lower ratings.

9.5 Intersection and Union of Rated Items


Intersection Approach
Only items rated by both users are considered. If User A rated Movies 1, 2 and 3, while User B rated Movies 2, 3
and 4, their intersection is {Movie 2, Movie 3}.

This approach ignores Movies 1 and 4. Its disadvantage is that a high similarity may be obtained from very few
shared items.

Union Approach
All items rated by either user are included: {Movie 1, Movie 2, Movie 3, Movie 4}. A missing mean-centred rating
can be treated as zero.

This reduces similarity when users have many unshared items. It acts as a form of significance adjustment
because the denominator becomes larger while unshared items do not increase the numerator.

Important Caution
A missing rating does not necessarily mean that the user dislikes the item. It may simply mean that the user
has not seen or purchased it. Treating every missing raw rating as an actual zero rating can be misleading.

9.6 Significance Weighting


Significance weighting reduces similarity when two users have rated only a few common items. A common
method is:

AdjustedSimilarity = Similarity × min(n / N, 1)


Where:
● n = number of commonly rated items
● N = minimum number of common ratings considered reliable

Example
Suppose Pearson similarity = 0.90, commonly rated items = 2, reliability threshold = 10.

AdjustedSimilarity = 0.90 × (2/10) = 0.18


Although the original similarity was 0.90, the adjusted similarity is only 0.18 because it was calculated from only
two shared ratings. If two users have 10 or more common ratings, the complete similarity score can be used.
10. Predicting a Missing Rating in UBCF
A missing rating can be predicted using the ratings of similar users. A commonly used formula is:

ŕ(u,j) = r̄u + [Σi w(u,i)(r(i,j) - r̄i)] / [Σi |w(u,i)|]


Where:
● ŕ(u,j) = predicted rating of user u for item j
● r̄u = target user's average rating
● w(u,i) = similarity between target user u and neighbour i
● r(i,j) = neighbour i's rating for item j
● r̄i = neighbour i's average rating

Simple Example
Amit's average rating is 3.5. Two similar users rated Inception:

Neighbour Similarity Rating User Average


Neha 0.9 5 4
Priya 0.7 4 3

Prediction:

ŕ = 3.5 + [0.9(5-4) + 0.7(4-3)] / (0.9+0.7)


ŕ = 3.5 + (0.9+0.7)/1.6

ŕ = 4.5

Therefore, Amit's predicted rating for Inception is 4.5, so it is a strong recommendation.


11. Item-Based Collaborative Filtering (IBCF)
Item-Based Collaborative Filtering finds similar items instead of similar users. Its principle is:
If a user likes one item, recommend another item that similar users have rated in a similar way.

Main Steps
● Select an item already liked by the user.
● Compare that item with other items.
● Find items with similar rating patterns.
● Predict the user's ratings for those items.
● Recommend the highest-rated unseen items.

Example
Suppose many users who liked Titanic also liked The Notebook. If Riya gave Titanic a rating of 5 but has not
watched The Notebook, the system may recommend The Notebook to her.

Item-Rating Pattern
User Titanic The Notebook Batman
U1 5 5 2
U2 4 4 1
U3 5 4 2
U4 2 2 5

Titanic and The Notebook receive similar ratings from the same users. Therefore, they have high item-item
similarity. Batman has the opposite rating pattern and is not similar to them.
12. Difference Between UBCF and IBCF
Point User-Based CF Item-Based CF
Main comparison User with user Item with item
Main question Which users are similar? Which items are similar?
Recommendation Items liked by similar users Items similar to those already liked
Matrix operation Complete a user's row Complete an item's column
Example Users like Amit also liked Inception Inception is similar to movies Amit liked
Stability User preferences may change Item relationships are often more stable
Suitable when Number of users is manageable There are many users but fewer items
13. Content-Based Recommendation
A content-based system uses the characteristics or description of items. It recommends items similar to those a
user liked previously.

Example
Suppose a user likes movies with the following characteristics: Science fiction, Space, Adventure, Christopher
Nolan.

The system may recommend other movies containing similar characteristics.

Movie Feature Table


Movie Genre Director Theme
Interstellar Science fiction Christopher Nolan Space
Inception Science fiction Christopher Nolan Dreams
The Notebook Romance Nick Cassavetes Relationship

If a user likes Interstellar, Inception may receive a high content-similarity score.

Advantages
● Can recommend new items that have no ratings.
● Does not require similar users.
● Recommendations can be explained using item features.

Limitations
● Requires good item descriptions.
● May repeatedly recommend very similar items.
● May not introduce users to different types of content.
This repeated recommendation of similar items is sometimes called over-specialisation.
14. Hybrid Recommender System
A hybrid system combines two or more recommendation approaches. It may combine:
● Collaborative filtering
● Content-based filtering
● User information
● Item information
● Context such as time, location or device

Example
An online movie platform may calculate:

FinalScore = 0.6 (CollaborativeScore) + 0.4 (ContentScore)


Suppose a movie receives Collaborative score = 4.5, Content score = 4.0. Then:

FinalScore = 0.6(4.5) + 0.4(4.0) = 2.7 + 1.6

FinalScore = 4.3

Why Use a Hybrid System?


It can reduce the weaknesses of individual techniques. For example:
● Collaborative filtering struggles with a new item having no ratings.
● Content-based filtering can still recommend it using its description.
● Collaborative filtering can provide variety beyond items with identical descriptions.
15. Cold-Start Problem
Although not described in detail on the slides, this is an important issue connected to the methods discussed.

New-User Problem
A newly registered user has not rated anything. The system cannot find similar users.
Possible solution: ask the user to select favourite categories or rate a few popular items.

New-Item Problem
A newly added item has no ratings. Collaborative filtering cannot easily recommend it.
Possible solution: use content-based information such as category, genre, description and brand.

Hybrid systems are particularly useful for handling cold-start situations.


Overall Working Example
Consider the following matrix:

User Titanic Batman Inception The Notebook


Amit 5 2 ? 5
Neha 4 2 5 4
Ravi 1 5 3 1
Priya 5 2 4 5

To recommend a movie to Amit:


● Amit is compared with other users.
● Neha and Priya are found to be similar to Amit.
● Neha rated Inception 5.
● Priya rated Inception 4.
● The system predicts that Amit will also give Inception a high rating.
● Inception is recommended to Amit.
In item-based filtering:
● Amit likes Titanic and The Notebook.
● Inception is compared with those movies.
● Users who liked Titanic and The Notebook also gave Inception high ratings.
● Therefore, Inception is recommended to Amit.
In content-based filtering:
● The system examines the genres, actors, directors or descriptions of Amit's liked movies.
● It searches for another movie with similar characteristics.
● The matching movie is recommended.
In a hybrid approach, all these scores can be combined.

Quick Summary
Term Meaning
Association rules Recommend items frequently occurring together
Personalized recommendation Give different recommendations to different users
Explicit rating Directly provided by the user
Implicit rating Inferred from user behaviour
Collaborative filtering Learn recommendations from the preferences of many users
Term Meaning
User-rating matrix Stores users, items and ratings
Sparse matrix A matrix containing many missing ratings
UBCF Recommend items liked by similar users
Pearson correlation Compare users' rating patterns after adjusting for their averages
Cosine similarity Compare the direction of rating vectors
Significance weighting Reduce similarity when users share very few ratings
IBCF Recommend items similar to the items the user already likes
Content-based system Recommend items using their features or descriptions
Hybrid system Combine multiple recommendation methods
PCA and matrix factorization Intentionally omitted for now, as requested
Worked Example 1: Predicting Missing Ratings (Pearson-Based UBCF)
We can calculate all three missing ratings using user-based collaborative filtering and only the values available in
the table.

Given Ratings
User Titanic Batman Inception Superman
Amit 5 2 ? 1
Neha 4 1 5 ?
Ravi 1 5 4 5
Priya 5 2 4 ?

We will use:
● Pearson correlation to find similar users.
● Only positively similar users as neighbours.
● Mean-centred prediction.
The prediction formula is:

ŕ(u,m) = r̄u + [Σv s(u,v)(r(v,m) - r̄v)] / [Σv |s(u,v)|]

1. Predict Amit's Rating for Inception


Step 1: Calculate Each User's Average
Only existing ratings are included.

r̄Amit = (5+2+1)/3 = 8/3 = 2.67


r̄Neha = (4+1+5)/3 = 10/3 = 3.33
r̄Priya = (5+2+4)/3 = 11/3 = 3.67

Step 2: Find Users Similar to Amit


Amit and Neha have commonly rated Titanic and Batman:

Movie Amit Neha


Titanic 5 4
Batman 2 1

Their pattern is identical: Neha always gives one point less than Amit.

s(Amit, Neha) = 1
Amit and Priya also have common ratings:

Movie Amit Priya


Titanic 5 5
Batman 2 2

Their ratings are identical.

s(Amit, Priya) = 1
Both Neha and Priya rated Inception, so both can be used.

Step 3: Apply the Prediction Formula


ŕ(Amit,Inception) = 2.67 + [1(5-3.33) + 1(4-3.67)] / (1+1)
Calculate the rating deviations: 5 − 3.33 = 1.67, 4 − 3.67 = 0.33

ŕ(Amit,Inception) = 2.67 + (1.67+0.33)/2 = 2.67 + 1

ŕ(Amit, Inception) = 3.67 (≈ 3.7)

2. Predict Neha's Rating for Superman


r̄Neha = 3.33
Amit is positively similar to Neha:

s(Neha, Amit) = 1
Amit's Superman rating is 1, and Amit's average is 2.67. Because there is only one positively similar neighbour:

ŕ(Neha,Superman) = 3.33 + [1(1-2.67)]/1 = 3.33 - 1.67

ŕ(Neha, Superman) = 1.66 (≈ 1.7)

The prediction is low because Amit, whose rating pattern is similar to Neha's, rated Superman only 1.

3. Predict Priya's Rating for Superman


r̄Priya = 3.67
Priya and Amit gave identical ratings to their commonly rated movies:

Movie Priya Amit


Titanic 5 5
Batman 2 2
s(Priya, Amit) = 1
Amit's Superman rating is 1.

ŕ(Priya,Superman) = 3.67 + [1(1-2.67)]/1 = 3.67 - 1.67

ŕ(Priya, Superman) = 2.00

Completed Matrix
User Titanic Batman Inception Superman
Amit 5 2 3.67 1
Neha 4 1 5 1.66
Ravi 1 5 4 5
Priya 5 2 4 2.00

Final Answers
● Amit – Inception = 3.67
● Neha – Superman = 1.66
● Priya – Superman = 2.00
These predictions should be treated cautiously because the table is very small. In particular, some similarities
are based on only two commonly rated movies; with two points, Pearson correlation can easily become +1,
even when there is not enough data to establish reliable similarity.
Worked Example 2: Predicting Chan's Ratings (Cosine-Similarity UBCF)
Let us calculate all three missing ratings for Chan using the complete data and cosine-similarity-based user
collaborative filtering.

1. Original Rating Table


User Titanic Batman Inception Superman Spiderman Matrix
Michel 2.5 3.5 3 3.5 2.5 3
Satya 3 3.5 1.5 5 3 3.5
Paranav 2.5 3 N/A 3.5 N/A 4
Suresh N/A 3.5 3 4 2.5 4.5
Tom 3 4 2 3 2 3
Leo 3 4 N/A 5 3.5 3
Chan N/A 4.5 N/A 4 1 N/A

We need to predict Chan's ratings for Titanic, Inception, and Matrix.

Part A: Calculate Similarity with Chan


For cosine similarity, N/A is represented by zero. Chan's vector is:

C = (0, 4.5, 0, 4, 1, 0)
Similarity(C,U) = (C · U) / (|C| |U|)

Magnitude of Chan's Vector


|C| = √(0²+4.5²+0²+4²+1²+0²) = √(20.25+16+1) = √37.25 = 6.1033

Similarity Between Chan and Michel


Michel's vector: M = (2.5, 3.5, 3, 3.5, 2.5, 3)

C · M = (0)(2.5)+(4.5)(3.5)+(0)(3)+(4)(3.5)+(1)(2.5)+(0)(3) = 15.75+14+2.5 =
32.25
Michel's magnitude:

|M| = √55 = 7.4162


Similarity(C,M) = 32.25 / (6.1033 × 7.4162)

Similarity(C, Michel) = 0.7125


Similarities with All Users
Applying the same calculation to every user:

User Cosine Similarity with Chan


Michel 0.7125
Satya 0.7602
Paranav 0.6832
Suresh 0.7028
Tom 0.7342
Leo 0.8056

Leo has the highest similarity with Chan.

Part B: Multiply Ratings by Similarities


Each user's rating is multiplied by their similarity with Chan:

Weighted rating = Similarity × Rating


For example, Michel's weighted Titanic rating is 0.7125 × 2.5 = 1.7813, and Michel's weighted Batman rating is
0.7125 × 3.5 = 2.4938.

The complete weighted table (Titanic, Inception, Matrix):

User Similarity Titanic (weighted) Inception (weighted) Matrix (weighted)


Michel 0.7125 2.5×0.7125=1.7813 3×0.7125=2.1375 3×0.7125=2.1375
Satya 0.7602 3×0.7602=2.2806 1.5×0.7602=1.1403 3.5×0.7602=2.6608
Paranav 0.6832 2.5×0.6832=1.7079 N/A 4×0.6832=2.7327
Suresh 0.7028 N/A 3×0.7028=2.1085 4.5×0.7028=3.1628
Tom 0.7342 3×0.7342=2.2025 2×0.7342=1.4684 3×0.7342=2.2025
Leo 0.8056 3×0.8056=2.4167 N/A 3×0.8056=2.4167

Part C: Predict Chan's Missing Values


The weighted prediction formula is:

ŕ(Chan,j) = [Σu Similarity(Chan,u) × r(u,j)] / [Σu |Similarity(Chan,u)|]


Only users who actually rated the movie are included. A missing rating is not treated as a real zero during the
final prediction.

Predict Chan's Titanic Rating


Suresh did not rate Titanic, so Suresh is excluded.

Numerator = 1.7813+2.2806+1.7079+2.2025+2.4167 = 10.3890


Denominator = 0.7125+0.7602+0.6832+0.7342+0.8056 = 3.6957
ŕ(Chan,Titanic) = 10.3890 / 3.6957

ŕ(Chan, Titanic) = 2.81 (≈ 2.8)

Predict Chan's Inception Rating


Paranav and Leo did not rate Inception, so they are excluded.

Numerator = 2.1375+1.1403+2.1085+1.4684 = 6.8547


Denominator = 0.7125+0.7602+0.7028+0.7342 = 2.9097
ŕ(Chan,Inception) = 6.8547 / 2.9097

ŕ(Chan, Inception) = 2.36 (≈ 2.4)

Predict Chan's Matrix Rating


Every other user rated Matrix, so all six users are included.

Numerator = 2.1375+2.6608+2.7327+3.1628+2.2025+2.4167 = 15.3130


Denominator = 0.7125+0.7602+0.6832+0.7028+0.7342+0.8056 = 4.3985
ŕ(Chan,Matrix) = 15.3130 / 4.3985

ŕ(Chan, Matrix) = 3.48 (≈ 3.5)

Completed Ratings for Chan


Movie Chan's Rating
Titanic 2.81 (predicted)
Batman 4.5 (actual)
Inception 2.36 (predicted)
Superman 4 (actual)
Spiderman 1 (actual)
Matrix 3.48 (predicted)

Therefore, the completed Chan vector is:

Chan = (2.81, 4.5, 2.36, 4, 1, 3.48)

The highest predicted missing rating is for Matrix, so among the three unseen movies, Matrix should be
recommended first to Chan.
Important distinction: zero is used for N/A while calculating the cosine similarities. During final prediction,
users who have N/A for the movie must be excluded from both the numerator and denominator.

You might also like