Presentation is loading. Please wait.

Presentation is loading. Please wait.

Announcements Milestone 2 – autolab disk quota issues: – classifier implementation issues: Almost any Weka classifier can be used on our datasets … with.

Similar presentations


Presentation on theme: "Announcements Milestone 2 – autolab disk quota issues: – classifier implementation issues: Almost any Weka classifier can be used on our datasets … with."— Presentation transcript:

1

2 Announcements Milestone 2 – autolab disk quota issues: – classifier implementation issues: Almost any Weka classifier can be used on our datasets … with some work … – meta.FilteredClassifier, meta.MultiClassClassifier, meta.ClassificationViaRegression If you didn’t do that work for MS2 you will for MS3 – meta.GridSearch, meta.CVParameterSelection, … – So: 48 hr extension but TA in charge is out of town Thus and Fri  Milestone 3 – is out … – major change: we’re now trying to get the best single classifier for all 12 problems

3 Social/Collaborative Filtering

4 Outline What is CF? Nearest-neighbor methods for CF – One old-school paper: BellCore’s movie recommender – Some general discussion CF reduced to classification CF reduced to matrix factoring Other uses of matrix factoring in ML

5 WHAT IS COLLABORATIVE FILTERING? AKA social filtering, recommendation systems, …

6 What is collaborative filtering?

7

8

9

10

11

12 Other examples of social filtering….

13

14

15

16 Everyday Examples of Collaborative Filtering... Bestseller lists Top 40 music lists The “ recent returns ” shelf at the library Unmarked but well-used paths thru the woods The printer room at work “ Read any good books lately? ”.... Common insight: personal tastes are correlated: – If Alice and Bob both like X and Alice likes Y then Bob is more likely to like Y – especially (perhaps) if Bob knows Alice

17 SOCIAL/COLLABORATIVE FILTERING: NEAREST-NEIGHBOR METHODS

18 BellCore ’ s MovieRecommender Recommending And Evaluating Choices In A Virtual Community Of Use. Will Hill, Larry Stead, Mark Rosenstein and George Furnas, Bellcore; CHI 1995 By virtual community we mean "a group of people who share characteristics and interact in essence or effect only". In other words, people in a Virtual Community influence each other as though they interacted but they do not interact. Thus we ask: "Is it possible to arrange for people to share some of the personalized informational benefits of community involvement without the associated communications costs?"

19 MovieRecommender Goals Recommendations should : simultaneously ease and encourage rather than replace social processes....should make it easy to participate while leaving in hooks for people to pursue more personal relationships if they wish. be for sets of people not just individuals...multi-person recommending is often important, for example, when two or more people want to choose a video to watch together. be from people not a black box machine or so-called "agent". tell how much confidence to place in them, in other words they should include indications of how accurate they are.

20 BellCore ’ s MovieRecommender Participants sent email to videos@bellcore.com System replied with a list of 500 movies to rate on a 1-10 scale (250 random, 250 popular) – Only subset need to be rated New participant P sends in rated movies via email System compares ratings for P to ratings of (a random sample of) previous users Most similar users are used to predict scores for unrated movies (more later) System returns recommendations in an email message.

21 Suggested Videos for: John A. Jamus. Your must-see list with predicted ratings: 7.0 "Alien (1979)" 6.5 "Blade Runner" 6.2 "Close Encounters Of The Third Kind (1977)" Your video categories with average ratings: 6.7 "Action/Adventure" 6.5 "Science Fiction/Fantasy" 6.3 "Children/Family" 6.0 "Mystery/Suspense" 5.9 "Comedy" 5.8 "Drama"

22 The viewing patterns of 243 viewers were consulted. Patterns of 7 viewers were found to be most similar. Correlation with target viewer: 0.59 viewer-130 (unlisted@merl.com) 0.55 bullert,jane r (bullert@cc.bellcore.com) 0.51 jan_arst (jan_arst@khdld.decnet.philips.nl) 0.46 Ken Cross (moose@denali.EE.CORNELL.EDU) 0.42 rskt (rskt@cc.bellcore.com) 0.41 kkgg (kkgg@Athena.MIT.EDU) 0.41 bnn (bnn@cc.bellcore.com) By category, their joint ratings recommend: Action/Adventure: "Excalibur" 8.0, 4 viewers "Apocalypse Now" 7.2, 4 viewers "Platoon" 8.3, 3 viewers Science Fiction/Fantasy: "Total Recall" 7.2, 5 viewers Children/Family: "Wizard Of Oz, The" 8.5, 4 viewers "Mary Poppins" 7.7, 3 viewers Mystery/Suspense: "Silence Of The Lambs, The" 9.3, 3 viewers Comedy: "National Lampoon's Animal House" 7.5, 4 viewers "Driving Miss Daisy" 7.5, 4 viewers "Hannah and Her Sisters" 8.0, 3 viewers Drama: "It's A Wonderful Life" 8.0, 5 viewers "Dead Poets Society" 7.0, 5 viewers "Rain Man" 7.5, 4 viewers Correlation of predicted ratings with your actual ratings is: 0.64 This number measures ability to evaluate movies accurately for you. 0.15 means low ability. 0.85 means very good ability. 0.50 means fair ability.

23 BellCore ’ s MovieRecommender Evaluation: – Withhold 10% of the ratings of each user to use as a test set – Measure correlation between predicted ratings and actual ratings for test-set movie/user pairs

24

25 BellCore ’ s MovieRecommender Participants sent email to videos@bellcore.com System replied with a list of 500 movies to rate New participant P sends in rated movies via email System compares ratings for P to ratings of (a random sample of) previous users Most similar users are used to predict scores for unrated movies – Empirical Analysis of Predictive Algorithms for Collaborative Filtering Breese, Heckerman, Kadie, UAI98 System returns recommendations in an email message.

26 recap: k-nearest neighbor learning ? ? Given a test example x: 1.Find the k training-set examples (x1,y1),….,(xk,yk) that are closest to x. 2.Predict the most frequent label in that set. Given a test example x: 1.Find the k training-set examples (x1,y1),….,(xk,yk) that are closest to x. 2.Predict the most frequent label in that set. ? ?

27 Breaking it down: To train: – save the data To test: – For each test example x: 1.Find the k training-set examples (x 1,y 1 ),….,(x k,y k ) that are closest to x. 2.Predict the most frequent label in that set. 1.Find the k training-set examples (x 1,y 1 ),….,(x k,y k ) that are closest to x. 2.Predict the most frequent label in that set. Very fast! Prediction is relatively slow …... but it doesn’t depend on the number of classes, only the number of neighbors

28 recap: k-nearest neighbor learning ? ? Given a test example x: 1.Find the k training-set examples (x1,y1),….,(xk,yk) that are closest to x. 2.Predict the most frequent label in that set. Given a test example x: 1.Find the k training-set examples (x1,y1),….,(xk,yk) that are closest to x. 2.Predict the most frequent label in that set. ? ?

29 Algorithms for Collaborative Filtering 1: Memory-Based Algorithms (Breese et al, UAI98) v i,j = vote of user i on item j I i = items for which user i has voted Mean vote for i is Predicted vote for “ active user ” a for j is a weighted sum weight is based on similarity between user a and i weights of n similar users normalizer

30 Algorithms for Collaborative Filtering 1: Memory-Based Algorithms (Breese et al, UAI98) K-nearest neighbor Pearson correlation coefficient (Resnick ’ 94, Grouplens): Cosine distance, etc, …

31 SOCIAL/COLLABORATIVE FILTERING: TRADITIONAL CLASSIFICATION

32 What are other ways to formulate the collaborative filtering problem? Treat it like ordinary classification or regression

33 Collaborative + Content Filtering (Basu et al, AAAI98; Condliff et al, AI-STATS99) AirplaneMatrixRoom with a View... Hidalgo comedy, $2M action,$ 70M romance,$2 5M... action,$ 30M Joe 27,M,$70 k 9727 Carol 53,F, $20k 89... Kumar 25,M,$22 k 936 UaUa 48,M,$81 k 47???

34 Collaborative + Content Filtering As Classification (Basu, Hirsh, Cohen, AAAI98) AirplaneMatrixRoom with a View... Hidalgo comedyactionromance... action Joe 27,M,70k 1101 Carol 53,F,20k 110... Kumar 25,M,22k 1001 UaUa 48,M,81k 01??? Classification task: map (user,movie) pair into {likes,dislikes} Training data: known likes/dislikes Test data: active users Features: any properties of user/movie pair

35 Collaborative + Content Filtering As Classification (Basu et al, AAAI98) AirplaneMatrixRoom with a View... Hidalgo comedyactionromance... action Joe 27,M,70k 1101 Carol 53,F,20k 110... Kumar 25,M,22k 1001 UaUa 48,M,81k 01??? Features: any properties of user/movie pair (U,M) Examples: genre(U,M), age(U,M), income(U,M),... genre(Carol,Matrix) = action income(Kumar,Hidalgo) = 22k/year

36 Collaborative + Content Filtering As Classification (Basu et al, AAAI98) AirplaneMatrixRoom with a View... Hidalgo comedyactionromance... action Joe 27,M,70k 1101 Carol 53,F,20k 110... Kumar 25,M,22k 1001 UaUa 48,M,81k 01??? Features: any properties of user/movie pair (U,M) Examples: usersWhoLikedMovie(U,M): usersWhoLikedMovie(Carol,Hidalgo) = {Joe,...,Kumar} usersWhoLikedMovie(U a, Matrix) = {Joe,...}

37 Collaborative + Content Filtering As Classification (Basu et al, AAAI98) AirplaneMatrixRoom with a View... Hidalgo comedyactionromance... action Joe 27,M,70k 1101 Carol 53,F,20k 110... Kumar 25,M,22k 1001 UaUa 48,M,81k 01??? Features: any properties of user/movie pair (U,M) Examples: moviesLikedByUser(M,U): moviesLikedByUser(*,Joe) = {Airplane,Matrix,...,Hidalgo} actionMoviesLikedByUser(*,Joe)={Matrix,Hidalgo}

38 Collaborative + Content Filtering As Classification (Basu et al, AAAI98) AirplaneMatrixRoom with a View... Hidalgo comedyactionromance... action Joe 27,M,70k 1101 Carol 53,F,20k 110... Kumar 25,M,22k 1001 UaUa 48,M,81k 11??? Features: any properties of user/movie pair (U,M) genre={romance}, age=48, sex=male, income=81k, usersWhoLikedMovie={Carol}, moviesLikedByUser={Matrix,Airplane},...

39 Collaborative + Content Filtering As Classification (Basu et al, AAAI98) AirplaneMatrixRoom with a View... Hidalgo comedyactionromance... action Joe 27,M,70k 1101 Carol 53,F,20k 110... Kumar 25,M,22k 1001 UaUa 48,M,81k 11??? genre={romance}, age=48, sex=male, income=81k, usersWhoLikedMovie={Carol}, moviesLikedByUser={Matrix,Airplane},... genre={action}, age=48, sex=male, income=81k, usersWhoLikedMovie = {Joe,Kumar}, moviesLikedByUser={Matrix,Airplane},...

40 Collaborative + Content Filtering As Classification (Basu et al, AAAI98) Classification learning algorithm: rule learning (RIPPER) If NakedGun33/13 moviesLikedByUser and Joe usersWhoLikedMovie and genre=comedy then predict likes(U,M) If age>12 and age<17 and HolyGrail moviesLikedByUser and director=MelBrooks then predict likes(U,M) If Ishtar moviesLikedByUser then predict likes(U,M)

41 Basu et al 98 - results Evaluation: –Predict liked(U,M)= “ M in top quartile of U ’ s ranking ” from features, evaluate recall and precision –Features: Collaborative: UsersWhoLikedMovie, UsersWhoDislikedMovie, MoviesLikedByUser Content: Actors, Directors, Genre, MPAA rating,... Hybrid: ComediesLikedByUser, DramasLikedByUser, UsersWhoLikedFewDramas,... Results: at same level of recall (about 33%) –Ripper with collaborative features only is worse than the original MovieRecommender (by about 5 pts precision – 73 vs 78) –Ripper with hybrid features is better than MovieRecommender (by about 5 pts precision)

42 Matrix Factorization for Collaborative Filtering

43 Recovering latent factors in a matrix m movies v11 … …… vij … vnm V[i,j] = user i’s rating of movie j n users

44 Recovering latent factors in a matrix m movies n users m movies x1y1 x2y2.. …… xnyn a1a2..…am b1b2……bm v11 … …… vij … vnm ~ V[i,j] = user i’s rating of movie j

45 talk pilfered from  ….. KDD 2011

46

47 Recovering latent factors in a matrix m movies n users m movies x1y1 x2y2.. …… xnyn a1a2..…am b1b2……bm v11 … …… vij … vnm ~ V[i,j] = user i’s rating of movie j r W H V

48

49

50 for image denoising

51

52 Recovering latent factors in a matrix m movies n users m movies x1y1 x2y2.. …… xnyn a1a2..…am b1b2……bm v11 … …… vij … vnm ~ V[i,j] = user i’s rating of movie j r W H V

53 … is like Linear Regression …. m=1 regressors n instances (e.g., 150) predictions pl1pw1sl1sw1 pl2pw2sl2sw2.. …… plnpwn w1 w2 w3 w4 y1 …yiyn ~ Y[i,1] = instance i’s prediction W H Y r features (eg 4)

54 .. for many outputs at once…. m regressors n instances (e.g., 150) predictions pl1pw1sl1sw1 pl2pw2sl2sw2.. …… pln… w11w12 w21.. w31.. w41..… y11y12 …yn1 ~ Y[I,j] = instance i’s prediction for regression task j W H Y ym …ynm r features (eg 4) … where we also have to find the dataset!

55 Matrix factorization as SGD step size

56 Matrix factorization as SGD - why does this work? step size

57 Matrix factorization as SGD - why does this work? Here’s the key claim:

58 Checking the claim Think for SGD for logistic regression LR loss = compare y and ŷ = dot(w,x) similar but now update w (user weights) and x (movie weight) Think for SGD for logistic regression LR loss = compare y and ŷ = dot(w,x) similar but now update w (user weights) and x (movie weight)

59 What loss functions are possible? N1, N2 - diagonal matrixes, sort of like IDF factors for the users/movies “generalized” KL-divergence

60 What loss functions are possible?

61

62 ALS = alternating least squares

63 Matrix Multiplications in Machine Learning

64 Recovering latent factors in a matrix m movies n users m movies x1y1 x2y2.. …… xnyn a1a2..…am b1b2……bm v11 … …… vij … vnm ~ V[i,j] = user i’s rating of movie j r W H V

65 ….. vs k-means cluster means n examples 01 10.. …… xnyn a1a2..…am b1b2……bm v11 … …… vij … vnm ~ original data set indicators for r clusters Z M X

66 Matrix multiplication - 1 (Gram matrix) transpose of X x1y1 x2y2.. …… xnyn x1x2..…xn y1y2…yn … …… … … … ~ V[i,j] = inner product of instances i and j (Gram matrix) X XTXT V n instances (e.g., 150) r features (eg 2)

67 Matrix multiplication - 2 (Covariance matrix) transpose of X a1a2…am b1b2…bm v11 v12 v21v22 ~ XTXT x1y1 x2y2.. …… xnyn X assuming mean(X)=0 r features (eg 2) CXCX

68 Matrix multiplication - 2 (PCA) V = C X = X T X …variance/covariances E = eigenvectors(V) X E T = PCA(X) = Z Z(i,j) is similarity of example i to eigenvector j x1y1 x2y2.. …… xnyn X ETET e11 e12 e21e22 z1 z2.. …… zn Z Eigenvecs of C X I think of these as fixed point of a process where we predict each feature value from the others and C X

69 Matrix multiplication - 2 (PCA) V = C X = X T X …variance/covariances E = eigenvectors(V) X E T = PCA(X) = Z K … or use E(1:K, :) instead of E x1y1 x2y2.. …… xnyn X EKTEKT e11 e21 z1 z2.. … zn ZKZK top K eigenvecs of C X

70 Matrix multiplication - 3 (SVD) V = C X = X T X …variance/covariances E = eigenvectors(V) X E T = PCA(X) = Z X = Z E = Z Σ -1 Σ E = U Σ E … where U = Z Σ -1 … i.e., factored version of X Usually written as X = U Σ V x1y1 x2y2.. …… xnyn X E e11 e12 e21e22 z1 z2.. …… zn Z Eigenvecs of C X

71 Matrix multiplication - 3 (SVD) V = C X = X T X …variance/covariances E = eigenvectors(V) X E K T = PCA(X) = Z K … E K = E(1:K, :) instead of E X ≈ Z K E K ≈ Z K Σ -1 Σ E ≈ U K Σ E … where U K = Z K Σ -1 … i.e., factored version of X x1y1 x2y2.. …… xnyn X E e11 e12 e21e22 z1 z2.. … zn UKUK Eigenvecs of C X Σ Σ1

72 Matrix multiplication - 2 (SVD) eigenvectors of C X x1y1 x2y2.. …… xnyn x1x2..…xn y1y2…yn … …… … … … ~ original matrix UKUK E X n instances K features with zero covar and unit variances Σ Σ1 0 0 Σ2Σ2

73 Recovering latent factors in a matrix m movies n users m movies x1y1 x2y2.. …… xnyn a1a2..…am b1b2……bm v11 … …… vij … vnm ~ V[i,j] = user i’s rating of movie j r W H V


Download ppt "Announcements Milestone 2 – autolab disk quota issues: – classifier implementation issues: Almost any Weka classifier can be used on our datasets … with."

Similar presentations


Ads by Google