matrix factorization and collaborative filtering
play

Matrix Factorization and Collaborative Filtering MF Readings: - PowerPoint PPT Presentation

10-601 Introduction to Machine Learning Machine Learning Department School of Computer Science Carnegie Mellon University Matrix Factorization and Collaborative Filtering MF Readings: Matt Gormley (Koren


  1. 10-­‑601 ¡Introduction ¡to ¡Machine ¡Learning Machine ¡Learning ¡Department School ¡of ¡Computer ¡Science Carnegie ¡Mellon ¡University Matrix ¡Factorization and Collaborative ¡Filtering MF ¡Readings: Matt ¡Gormley (Koren et ¡al., ¡2009) Lecture ¡25 April ¡19, ¡2017 1

  2. Reminders • Homework 8: ¡Graphical Models – Release: ¡Mon, ¡Apr. ¡17 – Due: ¡Mon, ¡Apr. ¡24 ¡at ¡11:59pm • Homework 9: ¡Applications of ¡ML – Release: ¡Mon, ¡Apr. ¡24 – Due: ¡Wed, ¡May 3 ¡at ¡11:59pm 2

  3. Outline • Recommender ¡Systems – Content ¡Filtering – Collaborative ¡Filtering ¡(CF) – CF: ¡Neighborhood ¡Methods – CF: ¡Latent ¡Factor ¡Methods • Matrix ¡Factorization – Background: ¡Low-­‑rank ¡Factorizations – Residual ¡matrix – Unconstrained ¡Matrix ¡Factorization • Optimization ¡problem • Gradient ¡Descent, ¡SGD, ¡Alternating ¡Least ¡Squares • User/item ¡bias ¡terms ¡(matrix ¡trick) – Singular ¡Value ¡Decomposition ¡(SVD) – Non-­‑negative ¡Matrix ¡Factorization • Extra: ¡Matrix ¡Multiplication ¡in ¡ML – Matrix ¡Factorization – Linear ¡Regression – PCA – (Autoencoders) – K-­‑means 7

  4. RECOMMENDER ¡SYSTEMS 8

  5. Recommender ¡Systems A ¡Common ¡Challenge: – Assume ¡you’re ¡a ¡company ¡ selling ¡ items of ¡some ¡sort: ¡ movies, ¡songs, ¡products, ¡ etc. – Company ¡collects ¡millions ¡ of ¡ ratings from ¡ users of ¡ their ¡ items – To ¡maximize ¡profit ¡/ ¡user ¡ happiness, ¡you ¡want ¡to ¡ recommend items ¡that ¡ users ¡are ¡likely ¡to ¡want 9

  6. Recommender ¡Systems 10

  7. Recommender ¡Systems 11

  8. Recommender ¡Systems 12

  9. Recommender ¡Systems Problem ¡Setup • 500,000 ¡users • 20,000 ¡movies • 100 ¡million ¡ratings • Goal: ¡To ¡obtain ¡lower ¡root ¡mean ¡squared ¡error ¡ (RMSE) ¡than ¡Netflix’s ¡existing ¡system ¡on ¡3 ¡million ¡ held ¡out ¡ratings ¡ 13

  10. Recommender ¡Systems 14

  11. Recommender ¡Systems • Setup: – Items: ¡ movies, ¡songs, ¡products, ¡etc. (often ¡many ¡thousands) Star ¡Trek: ¡ – Users: ¡ Zootopia Strange Beyond Doctor ¡ watchers, ¡listeners, ¡purchasers, ¡etc. (often ¡many ¡millions) – Feedback: ¡ Alice 1 5 5-­‑star ¡ratings, ¡not-­‑clicking ¡‘next’, ¡ purchases, ¡etc. Bob 3 4 • Key ¡Assumptions: – Can ¡represent ¡ratings ¡numerically ¡ Charlie 3 5 2 as ¡a ¡user/item ¡matrix – Users ¡only ¡rate ¡a ¡small ¡number ¡of ¡ items ¡(the ¡matrix ¡is ¡sparse) 15

  12. Recommender ¡Systems 16

  13. Two ¡Types ¡of ¡Recommender ¡Systems Content ¡Filtering Collaborative ¡Filtering • Example : ¡Pandora.com • Example : ¡Netflix movie ¡ music ¡recommendations ¡ recommendations (Music ¡Genome ¡Project) • Pro: ¡ Does ¡not ¡assume ¡ • Con: Assumes ¡access ¡to ¡ access ¡to ¡side ¡information ¡ side ¡information ¡about ¡ about ¡items ¡(e.g. ¡does ¡not ¡ items ¡(e.g. ¡properties ¡of ¡a ¡ need ¡to ¡know ¡about ¡movie ¡ song) genres) • Pro: ¡ Got ¡a ¡new ¡item ¡to ¡ • Con: ¡ Does ¡not work ¡on ¡ add? ¡No ¡problem, ¡just ¡be ¡ new ¡items ¡that ¡have ¡no ¡ sure ¡to ¡include ¡the ¡side ¡ ratings information 17

  14. COLLABORATIVE ¡FILTERING 19

  15. Collaborative ¡Filtering • 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 20 Slide ¡from ¡William ¡Cohen

  16. Two ¡Types ¡of ¡Collaborative ¡Filtering 1. ¡Neighborhood ¡Methods 2. ¡Latent ¡Factor ¡Methods 21 Figures ¡from ¡Koren et ¡al. ¡(2009)

  17. Two ¡Types ¡of ¡Collaborative ¡Filtering 1. ¡Neighborhood ¡Methods In ¡the ¡figure, ¡assume ¡that ¡ a ¡green ¡line ¡indicates ¡the ¡ movie ¡was ¡ watched Algorithm: 1. Find neighbors based ¡ on ¡similarity ¡of ¡movie ¡ preferences 2. Recommend movies ¡ that ¡those ¡neighbors ¡ watched 22 Figures ¡from ¡Koren et ¡al. ¡(2009)

  18. Two ¡Types ¡of ¡Collaborative ¡Filtering 2. ¡Latent ¡Factor ¡Methods • Assume ¡that ¡both ¡ movies ¡and ¡users ¡ live ¡in ¡some ¡ low-­‑ dimensional ¡ space ¡ describing ¡ their ¡properties • Recommend a ¡ movie ¡based ¡on ¡ its ¡ proximity to ¡ the ¡user ¡in ¡the ¡ latent ¡space 23 Figures ¡from ¡Koren et ¡al. ¡(2009)

  19. MATRIX ¡FACTORIZATION 24

  20. Matrix ¡Factorization • Many ¡different ¡ways ¡of ¡factorizing ¡a ¡matrix • We’ll ¡consider ¡three: 1. Unconstrained ¡Matrix ¡Factorization 2. Singular ¡Value ¡Decomposition 3. Non-­‑negative ¡Matrix ¡Factorization • MF ¡is ¡just ¡another ¡example ¡of ¡a ¡ common ¡ recipe : 1. define ¡a ¡model 2. define ¡an ¡objective ¡function 3. optimize ¡with ¡SGD 25

  21. Matrix ¡Factorization Whiteboard – Background: ¡Low-­‑rank ¡Factorizations – Residual ¡matrix 27

  22. Example: ¡MF ¡for ¡Netflix ¡Problem TTLE PRETTY WOMAN SLEEPLESS IN SEA JULIUS CAESAR CASABLANCA TRA TTLE ROMANCE ATTLE HISTORY CLEOPA PRETTY WOMAN SLEEPLESS IN SEA NERO PLESS IN SEA TTY WOMAN N JULIUS CAESAR US CAESAR CASABLANCA ABLANCA TRA TRA OPA 1 1 0 0 0 1 0 1 1 1 O NERO JULIU SLEEP CLEOPA CASA CLEO PRET NERO 1 1 1 0 0 0 1 0 2 2 HISTORY 0 0 0 0 0 0 1 1 1 1 0 0 0 1 0 3 3 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 HISTORY HISTORY 1 1 1 1 1 1 1 1 X 0 0 0 0 0 0 BOTH 4 4 3 ROMANCE 0 0 1 1 1 1 0 0 1 0 0 0 - 1 - 1 - 1 1 1 1 - 1 1 BOTH 4 5 5 V T 0 0 1 0 0 0 5 - 1 - 1 1 1 1 - 1 1 1 ROMANCE 6 6 0 0 1 0 0 0 ROMANCE 6 - 1 - 1 - 1 1 1 - 1 1 1 7 7 0 0 0 0 1 1 0 0 0 0 0 0 7 R U R (b) Residual matrix (a) Example of rank-2 matrix factorization E 28 Figures ¡from ¡Aggarwal ¡(2016)

  23. Regression ¡vs. ¡Collaborative ¡Filtering Regression Collaborative ¡Filtering TRAINING ROWS NO DEMARCATION BETWEEN TRAINING AND TEST ROWS TEST ROWS NO DEMARCATION BETWEEN DEPENDENT INDEPENDENT DEPENDENT AND INDEPENDENT VARIABLES VARIABLES VARIABLE 29 Figures ¡from ¡Aggarwal ¡(2016)

  24. UNCONSTRAINED ¡MATRIX ¡ FACTORIZATION 30

  25. Unconstrained ¡Matrix ¡Factorization Whiteboard – Optimization ¡problem – SGD – SGD ¡with ¡Regularization – Alternating ¡Least ¡Squares – User/item ¡bias ¡terms ¡(matrix ¡trick) 31

  26. ������ Unconstrained ¡Matrix ¡Factorization In-­‑Class ¡Exercise Derive ¡a ¡block ¡coordinate ¡descent ¡algorithm ¡ for ¡the ¡Unconstrained ¡Matrix ¡Factorization ¡ problem. • User ¡vectors: • Set ¡of ¡non-­‑missing ¡entries: � u ∈ R r • Item ¡vectors: • Objective: � i ∈ R r � u � i ) 2 ( v ui − � T � , � ( u,i ) ∈ Z • Rating ¡prediction: v ui = � T u � i 32

  27. Matrix ¡Factorization (with ¡matrices) • User ¡vectors: ( W u ∗ ) T ∈ R r Figures ¡from ¡Koren et ¡al. ¡(2009) • Item ¡vectors: H ∗ i ∈ R r • Rating ¡prediction: V ui = W u ∗ H ∗ i = [ WH ] ui Figures ¡from ¡Gemulla et ¡al. ¡(2011) 33

  28. Matrix ¡Factorization (with ¡vectors) • User ¡vectors: � u ∈ R r Figures ¡from ¡Koren et ¡al. ¡(2009) • Item ¡vectors: � i ∈ R r • Rating ¡prediction: v ui = � T u � i 34

  29. ������ Matrix ¡Factorization (with ¡vectors) • Set ¡of ¡non-­‑missing ¡entries: Figures ¡from ¡Koren et ¡al. ¡(2009) • Objective: � u � i ) 2 ( v ui − � T � , � ( u,i ) ∈ Z 35

  30. ������ Matrix ¡Factorization (with ¡vectors) • Regularized ¡Objective: � u � i ) 2 ( v ui − � T � , � ( u,i ) ∈ Z Figures ¡from ¡Koren et ¡al. ¡(2009) || � i || 2 + � � || � u || 2 ) + λ ( i u • SGD ¡update ¡for ¡random ¡(u,i): 36

  31. ������ Matrix ¡Factorization (with ¡vectors) • Regularized ¡Objective: � u � i ) 2 ( v ui − � T � , � ( u,i ) ∈ Z Figures ¡from ¡Koren et ¡al. ¡(2009) || � i || 2 + � � || � u || 2 ) + λ ( i u • SGD ¡update ¡for ¡random ¡(u,i): e ui ← v ui − � T u � i � u ← � u + γ ( e ui � i − λ � u ) � i ← � i + γ ( e ui � u − λ � i ) 37

  32. Matrix ¡Factorization (with ¡matrices) • User ¡vectors: ( W u ∗ ) T ∈ R r Figures ¡from ¡Koren et ¡al. ¡(2009) • Item ¡vectors: H ∗ i ∈ R r • Rating ¡prediction: V ui = W u ∗ H ∗ i = [ WH ] ui Figures ¡from ¡Gemulla et ¡al. ¡(2011) 38

  33. Matrix ¡Factorization (with ¡matrices) • SGD Matrix$factorization$as$SGD$V$ V$why$does$ th this$wo $work? k? Figures ¡from ¡Koren et ¡al. ¡(2009) step size Figure ¡from ¡Gemulla et ¡al. ¡(2011) Figure ¡from ¡Gemulla et ¡al. ¡(2011) 39

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend