Download presentation
Presentation is loading. Please wait.
Published bySharlene Taylor Modified over 6 years ago
1
Recommender Systems: Content-based Systems & Collaborative Filtering
Note to other teachers and users of these slides: We would be delighted if you found this our material useful in giving your own lectures. Feel free to use these slides verbatim, or to modify them to fit your own needs. If you make use of a significant portion of these slides in your own lecture, please include this message, or a link to our web site: Recommender Systems: Content-based Systems & Collaborative Filtering
2
High Dimensional Data High dim. data Graph data Infinite data
Locality sensitive hashing Clustering Dimensionality reduction Graph data PageRank, SimRank Community Detection Spam Detection Infinite data Filtering data streams Web advertising Queries on streams Machine learning SVM Decision Trees Perceptron, kNN Apps Recommender systems Association Rules Duplicate document detection
3
Example: Recommender Systems
Customer X Buys Metallica CD Buys Megadeth CD Customer Y Does search on Metallica Recommender system suggests Megadeth from data collected about customer X
4
Recommendations Examples: Search Recommendations Items
Products, web sites, blogs, news items, …
5
From Scarcity to Abundance
Shelf space is a scarce commodity for traditional retailers Also: TV networks, movie theaters,… Web enables near-zero-cost dissemination of information about products From scarcity to abundance More choice necessitates better filters Recommendation engines How Into Thin Air made Touching the Void a bestseller: In 1988, a British mountain climber named Joe Simpson wrote a book called Touching the Void, a harrowing account of near death in the Peruvian Andes. It got good reviews but, only a modest success, it was soon forgotten. Then, a decade later, a strange thing happened. Jon Krakauer wroteInto Thin Air, another book about a mountain-climbing tragedy, which became a publishing sensation. SuddenlyTouching the Void started to sell again. Random House rushed out a new edition to keep up with demand. Booksellers began to promote it next to their Into Thin Air displays, and sales rose further. A revised paperback edition, which came out in January, spent 14 weeks on theNew York Times bestseller list. That same month, IFC Films released a docudrama of the story to critical acclaim. NowTouching the Void outsells Into Thin Air more than two to one. What happened? In short, Amazon.com recommendations. The online bookseller's software noted patterns in buying behavior and suggested that readers who liked Into Thin Airwould also like Touching the Void. People took the suggestion, agreed wholeheartedly, wrote rhapsodic reviews. More sales, more algorithm-fueled recommendations, and the positive feedback loop kicked in.
6
Sidenote: The Long Tail
Source: Chris Anderson (2004)
7
Read http://www.wired.com/wired/archive/12.10/tail.html to learn more!
Physical vs. Online Read to learn more!
8
Types of Recommendations
Editorial and hand curated List of favorites Lists of “essential” items Simple aggregates Top 10, Most Popular, Recent Uploads Tailored to individual users Amazon, Netflix, …
9
Formal Model X = set of Customers S = set of Items
Utility function u: X × S R R = set of ratings R is a totally ordered set e.g., 0-5 stars, real number in [0,1]
10
Utility Matrix Avatar LOTR Matrix Pirates Alice Bob Carol David
Find out blank David
11
Key Problems (1) Gathering “known” ratings for matrix
How to collect the data in the utility matrix (2) Extrapolate unknown ratings from the known ones Mainly interested in high unknown ratings We are not interested in knowing what you don’t like but what you like (3) Evaluating extrapolation methods How to measure success/performance of recommendation methods
12
(1) Gathering Ratings Explicit Implicit Ask people to rate items
Doesn’t work well in practice – people can’t be bothered Implicit Learn ratings from user actions E.g., purchase implies high rating What about low ratings?
13
More on ratings – Explicit ratings
Probably the most precise ratings Most commonly used (1 to 5, 1 to 7 Likert response scales) Research topics Optimal granularity of scale; indication that 10-point scale is better accepted in movie dom. An even more fine-grained scale was chosen in the joke recommender discussed by Goldberg et al. (2001), where a continuous scale (from −10 to +10) and a graphical input bar were used No precision loss from the discretization User preferences can be captured at a finer granularity Users actually "like" the graphical interaction method Multidimensional ratings (multiple ratings per movie such as ratings for actors and sound) Main problems Users not always willing to rate many items number of available ratings could be too small → sparse rating matrices → poor recommendation quality How to stimulate users to rate more items?
14
More on ratings – Implicit ratings
Typically collected by the web shop or application in which the recommender system is embedded When a customer buys an item, for instance, many recommender systems interpret this behavior as a positive rating Clicks, page views, time spent on some page, demo downloads … Implicit ratings can be collected constantly and do not require additional efforts from the side of the user Main problem One cannot be sure whether the user behavior is correctly interpreted For example, a user might not like all the books he or she has bought; the user also might have bought a book for someone else Implicit ratings can be used in addition to explicit ones; question of correctness of interpretation
15
(2) Extrapolating Utilities
Key problem: Utility matrix U is sparse Most people have not rated most items Cold start: New items have no ratings New users have no history Three approaches to recommender systems: 1) Content-based 2) Collaborative 3) Latent factor based Today!
16
Content-based Recommender Systems
17
Content-based Recommendations
Main idea: Recommend items to customer x similar to previous items rated highly by x Example: Movie recommendations Recommend movies with same actor(s), director, genre, … Websites, blogs, news Recommend other sites with “similar” content
18
Plan of Action Item profiles User profile likes build recommend Red
Circles Triangles match User profile
19
Item Profiles For each item, create an item profile
Profile is a set (vector) of features Movies: author, title, actor, director,… Text: Set of “important” words in document How to pick important features? Usual heuristic from text mining is TF-IDF (Term frequency * Inverse Doc Frequency) Term … Feature Document … Item
20
Sidenote: TF-IDF fij = frequency of term (feature) i in doc (item) j
ni = number of docs that mention term i N = total number of docs TF-IDF score: wij = TFij × IDFi Doc profile = set of words with highest TF-IDF scores, together with their scores Note: we normalize TF to discount for “longer” documents
21
User Profiles and Prediction
User profile possibilities: Weighted average of rated item profiles Variation: weight by difference from average rating for item … Prediction heuristic: Given user profile x and item profile i, estimate 𝑢(𝒙,𝒊) = cos(𝒙,𝒊) = 𝒙·𝒊 | 𝒙 |⋅| 𝒊 |
22
Item profile: vector with 0 or 1 for each Actor
Items are movies, only feature is “Actor” Item profile: vector with 0 or 1 for each Actor Suppose user x has watched 5 movies 2 movies featuring actor A 3 movies featuring actor B User profile = mean of item profiles Feature A’s weight = 2/5 = 0.4 Feature B’s weight = 3/5 = 0.6
23
Actor A’s movies rated 3 and 5 Actor B’s movies rated 1, 2 and 4
Same example, 1-‐5 star ratings Actor A’s movies rated 3 and 5 Actor B’s movies rated 1, 2 and 4 Useful step: Normalize ratings by subtracting user’s mean rating (3) Actor A’s normalized ratings = 0, +2 Profile weight = (0 + 2)/2 = 1 Actor B’s normalized ratings = -‐2, -‐1, +1 Profile weight = -‐2/3
24
θ User profile x, Item profile i
Estimate U(x,i) = cos(θ) = (x . i)/(|x||i|) x i θ Technically, the cosine distance is actually the angle θ And the cosine similarity is the angle 180-θ For convenience, we use cos(θ) as our similarity measure and call it the “cosine similarity” in this context. 10
25
Pros: Content-based Approach
+: No need for data on other users No cold-start or sparsity problems +: Able to recommend to users with unique tastes +: Able to recommend new & unpopular items No first-rater problem +: Able to provide explanations Can provide explanations of recommended items by listing content-features that caused an item to be recommended
26
Cons: Content-based Approach
–: Finding the appropriate features is hard E.g., images, movies, music –: Recommendations for new users How to build a user profile? –: Overspecialization Never recommends items outside user’s content profile People might have multiple interests Unable to exploit quality judgments of other users
27
Collaborative Filtering
Harnessing quality judgments of other users
28
Collaborative Filtering
Consider user x Find set N of other users whose ratings are “similar” to x’s ratings Estimate x’s ratings based on ratings of users in N x N
29
Similarity Metric Consider user x and y with rating vector rx and ry
We need a similarity metric sim(x, y) Intuitively we want: sim(A, B) > sim(A, C)
30
Finding “Similar” Users
rx = [*, _, _, *, ***] ry = [*, _, **, **, _] Let rx be the vector of user x’s ratings Jaccard similarity measure Problem: Ignores the value of the rating Cosine similarity measure sim(x, y) = cos(rx, ry) = 𝑟 𝑥 ⋅ 𝑟 𝑦 || 𝑟 𝑥 ||⋅ ||𝑟 𝑦 || Problem: Treats missing ratings as “negative” Pearson correlation coefficient Sxy = items rated by both users x and y rx, ry as sets: rx = {1, 4, 5} ry = {1, 3, 4} rx, ry as points: rx = {1, 0, 0, 1, 3} ry = {1, 0, 2, 2, 0} -- Jaccard is not appropriate as we want to consider weights 0,-1,-1,0,2 0,-1,1,1,-1 𝒔𝒊𝒎 𝒙,𝒚 = 𝒔∈ 𝑺 𝒙𝒚 𝒓 𝒙𝒔 − 𝒓 𝒙 𝒓 𝒚𝒔 − 𝒓 𝒚 𝒔∈ 𝑺 𝒙𝒚 𝒓 𝒙𝒔 − 𝒓 𝒙 𝟐 𝒔∈ 𝑺 𝒙𝒚 𝒓 𝒚𝒔 − 𝒓 𝒚 𝟐 rx, ry … avg. rating of x, y
31
Similarity Metric Intuitively we want: sim(A, B) > sim(A, C)
Cosine sim: Similarity Metric 𝒔𝒊𝒎(𝒙, 𝒚) = 𝒊 𝒓 𝒙𝒊 ⋅ 𝒓 𝒚𝒊 𝒊 𝒓 𝒙𝒊 𝟐 ⋅ 𝒊 𝒓 𝒚𝒊 𝟐 Intuitively we want: sim(A, B) > sim(A, C) Jaccard similarity: 1/5 < 2/4 Cosine similarity: > 0.322 Considers missing ratings as “negative” Solution: subtract the (row) mean sim A,B vs. A,C: 0.092 > Notice cosine sim. is correlation when data is centered at 0
32
Rating Predictions From similarity metric to recommendations:
Let rx be the vector of user x’s ratings Let N be the set of k users most similar to x who have rated item i Prediction for item s of user x: 𝑟 𝑥𝑖 = 1 𝑘 𝑦∈𝑁 𝑟 𝑦𝑖 𝑟 𝑥𝑖 = 𝑦∈𝑁 𝑠 𝑥𝑦 ⋅ 𝑟 𝑦𝑖 𝑦∈𝑁 𝑠 𝑥𝑦 Other options? Many other tricks possible… Shorthand: 𝒔 𝒙𝒚 =𝒔𝒊𝒎 𝒙,𝒚
33
Item-Item Collaborative Filtering
So far: User-user collaborative filtering Another view: Item-item For item i, find other similar items Estimate rating for item i based on ratings for similar items Can use same similarity metrics and prediction functions as in user-user model sij… similarity of items i and j rxj…rating of user u on item j N(i;x)… set items rated by x similar to i
34
Item-Item CF (|N|=2) users 12 11 10 9 8 7 6 5 4 3 2 1 movies
- unknown rating - rating between 1 to 5
35
Item-Item CF (|N|=2) users 12 11 10 9 8 7 6 5 4 3 2 1 ? movies
- estimate rating of movie 1 by user 5
36
Item-Item CF (|N|=2) users 12 11 10 9 8 7 6 5 4 3 2 1 ? sim(1,m) 1.00
-0.18 0.41 -0.10 -0.31 0.59 movies Here we use Pearson correlation as similarity: 1) Subtract mean rating mi from each movie i m1 = ( )/5 = row 1: [-2.6, 0, -0.6, 0, 0, 1.4, 0, 0, 1.4, 0, 0.4, 0] 2) Compute cosine similarities between rows Neighbor selection: Identify movies similar to movie 1, rated by user 5
37
Item-Item CF (|N|=2) users 12 11 10 9 8 7 6 5 4 3 2 1 ? sim(1,m) 1.00
-0.18 0.41 -0.10 -0.31 0.59 movies Compute similarity weights: s1,3=0.41, s1,6=0.59
38
Item-Item CF (|N|=2) users 12 11 10 9 8 7 6 5 4 3 2 1 movies
2.6 movies Predict by taking weighted average: r1.5 = (0.41* *3) / ( ) = 2.6 𝒓 𝒊𝒙 = 𝒋∈𝑵(𝒊;𝒙) 𝒔 𝒊𝒋 ⋅ 𝒓 𝒋𝒙 ∑ 𝒔 𝒊𝒋
39
Item-Item vs. User-User
Avatar LOTR Matrix Pirates Alice Bob Carol David There is a difference in the typical behavior of users and items, as it pertains to similarity. Intuitively, items tend to be classifiable in simple terms. For example, music tends to belong to a single genre. It is impossi- ble, e.g., for a piece of music to be both 60’s rock and 1700’s baroque. On the other hand, there are individuals who like both 60’s rock and 1700’s baroque, and who buy examples of both types of music. The consequence is that it is easier to discover items that are similar because they belong to the same genre, than it is to detect that two users are similar because they prefer one genre in common, while each also likes some genres that the other doesn’t care for. In practice, it has been observed that item-item often works better than user-user Why? Items are simpler, users have multiple tastes
40
Pros/Cons of Collaborative Filtering
+ Works for any kind of item No feature selection needed - Cold Start: Need enough users in the system to find a match - Sparsity: The user/ratings matrix is sparse Hard to find users that have rated the same items - First rater: Cannot recommend an item that has not been previously rated New items, Esoteric items - Popularity bias: Cannot recommend items to someone with unique taste Tends to recommend popular items
41
Hybrid Methods Implement two or more different recommenders and combine predictions Perhaps using a linear model Global baseline + collaborative filtering Add content-based methods to collaborative filtering Item profiles for new item problem Demographics to deal with new user problem
42
Global baseline estimate
Estimate Joe’s rating for the movie The Sixth Sense No feature selection needed Problem: Joe has not rated any movie similar to The Sixth Sense Global baseline estimate Mean movie rating: 3.7 stars The Six Sense is 0.5 stars above avg Joe rates 0.2 stars below avg Baseline estimate: – 0.2 = 4 stars
43
Combining Global Baseline with CF
Global baseline estimate Joe with give The Six Sense is 4 stars Local neighborhood (CF/NN) Joe didn’t like movie Signs Rate 1 star below his average rating Final estimate Joe will rate The Sixth Sense 3 stars
44
Global Baseline Estimate
Define similarity sij of items i and j Select k nearest neighbors N(i; x) Items most similar to i, that were rated by x Estimate rating rxi as the weighted average: baseline estimate for rxi μ = overall mean movie rating bx = rating deviation of user x = (avg. rating of user x) – μ bi = rating deviation of movie i 𝒃 𝒙𝒊 =𝝁+ 𝒃 𝒙 + 𝒃 𝒊
45
baseline estimate for rxi
Before: CF: Common Practice Define similarity sij of items i and j Select k nearest neighbors N(i; x) Items most similar to i, that were rated by x Estimate rating rxi as the weighted average: baseline estimate for rxi μ = overall mean movie rating bx = rating deviation of user x = (avg. rating of user x) – μ bi = rating deviation of movie i 𝒃 𝒙𝒊 =𝝁+ 𝒃 𝒙 + 𝒃 𝒊
46
Item-Item CF (|N|=2) users 12 11 10 9 8 7 6 5 4 3 2 1 movies
2.6 movies Predict by taking weighted average: r1.5 = (0.41* *3) / ( ) = 2.6 𝒓 𝒊𝒙 = 𝒋∈𝑵(𝒊;𝒙) 𝒔 𝒊𝒋 ⋅ 𝒓 𝒋𝒙 ∑ 𝒔 𝒊𝒋
47
Remarks & Practical Tips
- Evaluation - Error metrics - Complexity / Speed
48
Evaluation movies 1 3 4 5 2 users
49
Evaluation movies 1 3 4 5 2 ? users Test Data Set
50
Evaluating Predictions
Compare predictions with known ratings Root-mean-square error (RMSE) 𝑥𝑖 𝑟 𝑥𝑖 − 𝑟 𝑥𝑖 ∗ where 𝒓𝒙𝒊 is predicted, 𝒓 𝒙𝒊 ∗ is the true rating of x on i Precision at top 10: % of those in top 10 Rank Correlation: Spearman’s correlation between system’s and user’s complete rankings
51
Problems with Error Measures
Narrow focus on accuracy sometimes misses the point Prediction Diversity Prediction Context Order of predictions In practice, we care only to predict high ratings: RMSE might penalize a method that does well for high ratings and badly for others
52
Collaborative Filtering: Complexity
Expensive step is finding k most similar customers: O(|X|) Too expensive to do at runtime Could pre-compute Naïve pre-computation takes time O(k ·|X|) X … set of customers We already know how to do this! Near-neighbor search in high dimensions (LSH) Clustering Dimensionality reduction
53
Pre-processing for item-based filtering
Item-based filtering does not solve the scalability problem itself Pre-processing approach by Amazon.com (in 2003) Calculate all pair-wise item similarities in advance The neighborhood to be used at run-time is typically rather small, because only items are taken into account which the user has rated Item similarities are supposed to be more stable than user similarities Memory requirements Up to N2 pair-wise similarities to be memorized (N = number of items) in theory In practice, this is significantly lower (items with no co-ratings) Further reductions possible Minimum threshold for co-ratings Limit the neighborhood size (might affect recommendation accuracy)
54
Tip: Add Data Leverage all the data Add more data
Don’t try to reduce data size in an effort to make fancy algorithms work Simple methods on large data do best Add more data e.g., add IMDB data on genres More data beats better algorithms
55
Homework 9.3.1 9.2.3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.