Recommendation Systems Prof. Mike Hughes Many ideas/slides - - PowerPoint PPT Presentation

recommendation systems
SMART_READER_LITE
LIVE PREVIEW

Recommendation Systems Prof. Mike Hughes Many ideas/slides - - PowerPoint PPT Presentation

Tufts COMP 135: Introduction to Machine Learning https://www.cs.tufts.edu/comp/135/2019s/ Recommendation Systems Prof. Mike Hughes Many ideas/slides attributable to: Liping Liu (Tufts), Emily Fox (UW) Matt Gormley (CMU) 2 Recommendation


slide-1
SLIDE 1

Recommendation Systems

2

Tufts COMP 135: Introduction to Machine Learning https://www.cs.tufts.edu/comp/135/2019s/

Many ideas/slides attributable to: Liping Liu (Tufts), Emily Fox (UW) Matt Gormley (CMU)

  • Prof. Mike Hughes
slide-2
SLIDE 2

Recommendation Task:

Which users will like which items?

3

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-3
SLIDE 3

4

Mike Hughes - Tufts COMP 135 - Spring 2019

  • Need recommendation everywhere
slide-4
SLIDE 4

Utility matrix

5

Mike Hughes - Tufts COMP 135 - Spring 2019

  • The “value” or “utility” of items to users
  • Only known when ratings happen
  • In practice, very sparse, many entries unknown

4 2

slide-5
SLIDE 5

Rec Sys Unit Objectives

  • Explain Recommendation Task
  • Predict which users will like which items
  • Explain two major types of recommendation
  • Content-based (have features for items/users)
  • Collaborative filtering (only have scores for item+user pairs)
  • Detailed Approach: Matrix Factorization + SGD
  • Evaluation:
  • Precision/recall for binary recs

6

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-6
SLIDE 6

7

Mike Hughes - Tufts COMP 135 - Spring 2019

Task: Recommendation

Supervised Learning Unsupervised Learning Reinforcement Learning

Collaborative filtering Content filtering

slide-7
SLIDE 7

Content-based recommendation

8

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-8
SLIDE 8

Content-based

9

Mike Hughes - Tufts COMP 135 - Spring 2019

FEATURE VALUE is_round 1 is_juicy 1 average_price $1.99/lb

Key aspect: Have common features for each item

slide-9
SLIDE 9

Content-Based Recommendation

  • Reduce per-user prediction to supervised

prediction problem

10

Mike Hughes - Tufts COMP 135 - Spring 2019

What features are necessary? What are pitfalls?

  • Fig. Credit: Emily Fox (UW)
slide-10
SLIDE 10

Possible Per-Item Features

  • Movie
  • Set of actors, director, genre, year
  • Document
  • Bag of words, author, genre, citations
  • Product
  • Tags, reviews

11

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-11
SLIDE 11

Content-Based Recommender

12

Mike Hughes - Tufts COMP 135 - Spring 2019

  • Fig. Credit: Emily Fox (UW)
slide-12
SLIDE 12

Collaborative filtering

13

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-13
SLIDE 13

External Slides

  • Matt Gormley at CMU
  • https://www.cs.cmu.edu/~mgormley/courses/

10601-s17/slides/lecture25-mf.pdf

  • We’ll use page 4 – 34
  • Start: ”Recommender Systems” slide
  • Stop at: comparison of optimization algorithms

14

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-14
SLIDE 14

Matrix Factorization (MF)

15

Mike Hughes - Tufts COMP 135 - Spring 2019

  • User ! represented by vector "# ∈ %&
  • Item ' represented by vector () ∈ %&
  • Inner product "#

*() approximates the utility +#)

  • Intuition:
  • Two items with similar vectors get similar utility scores

from the same user;

  • Two users with similar vectors give similar utility

scores to the same item

slide-15
SLIDE 15

Training an MF model

16

Mike Hughes - Tufts COMP 135 - Spring 2019

  • Variables to optimize
  • ! = #$: & = 1, … , * , + = ,$: - = 1, … , .
  • Training objective
  • How to optimize?
  • Stochastic gradient descent, visit each user-item entry at

random!

  • Key practical aspects
  • Regularization terms to prevent overfitting

min

!,+ 2 $3

.$3 − #$

5,3 6 + 8 2 $

#$ 6

6 + 8 2 3

,3 6

6

slide-16
SLIDE 16

Include intercept/bias terms!

17

Mike Hughes - Tufts COMP 135 - Spring 2019

  • Per-user scalar +,
  • Per-item scalar -.

Why include these?

min

2,4 5 ,.

6,. − 8,

9:. − +, − -. ; + = 5 ,

8, ;

; + = 5 .

:. ;

;

slide-17
SLIDE 17

Include intercept/bias terms!

18

Mike Hughes - Tufts COMP 135 - Spring 2019

  • Per-user scalar +,
  • Per-item scalar -.

Why include these? Improve accuracy Some items just more popular Some users just more positive

min

2,4 5 ,.

6,. − 8,

9:. − +, − -. ; + = 5 ,

8, ;

; + = 5 .

:. ;

;

slide-18
SLIDE 18

Summary of Methods

19

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-19
SLIDE 19

20

Mike Hughes - Tufts COMP 135 - Spring 2019

Task: Recommendation

Supervised Learning Unsupervised Learning Reinforcement Learning

Collaborative filtering Content-based filtering

slide-20
SLIDE 20

Recall: Supervised Method

21

Mike Hughes - Tufts COMP 135 - Spring 2019

Supervised Learning Unsupervised Learning Reinforcement Learning

Data, Label Pairs Performance measure Task data x label y

{xn, yn}N

n=1

Training Prediction Evaluation

slide-21
SLIDE 21

Example: Per-User Predictor

22

Mike Hughes - Tufts COMP 135 - Spring 2019

Supervised Learning Unsupervised Learning Reinforcement Learning

For each item n: x: User-Item Feature y: Rating Score Performance measure Task User-item Feature vector x Predicted rating y

{xn, yn}N

n=1

Regressor / Classifier

Content-based filtering

slide-22
SLIDE 22

23

Mike Hughes - Tufts COMP 135 - Spring 2019

23

Mike Hughes - Tufts COMP 135 - Spring 2019

Data Examples data x

Supervised Learning Unsupervised Learning Reinforcement Learning

{xn}N

n=1

Task summary

  • r model
  • f x

Performance measure

Recall: Unsupervised Method

slide-23
SLIDE 23

24

Mike Hughes - Tufts COMP 135 - Spring 2019

24

Mike Hughes - Tufts COMP 135 - Spring 2019

Data Examples Matrix M Specific entry indicies (i,j)

Supervised Learning Unsupervised Learning Reinforcement Learning

Task Low-rank factors

that reconstruct M

Performance measure

Example: Matrix Factorization

Value of M_ij

Collaborative filtering

slide-24
SLIDE 24

Evaluation

25

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-25
SLIDE 25

Evaluation

26

Mike Hughes - Tufts COMP 135 - Spring 2019

Item ranking 1 2 3 4 5 6 7 8 Actual usage 1 1 1 1

Assumptions

  • For given user, we can rate each item with score
  • We care most about our top-score predictions
  • Setup:
  • Algorithm rates each item with score
  • Sort items from high to low score
  • Have “true” relevant/not usage labels (unused by algo.)
slide-26
SLIDE 26

27

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-27
SLIDE 27

28

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-28
SLIDE 28

External Slides

  • Emily Fox’s slides
  • https://courses.cs.washington.edu/courses/cse

416/18sp/slides/L13_matrix- factorization.pdf#page=19

  • Start: Slide 19 (world of all baby products)
  • Stop: End of that section

29

Mike Hughes - Tufts COMP 135 - Spring 2019

slide-29
SLIDE 29

Precision-Recall Curve

30

Mike Hughes - Tufts COMP 135 - Spring 2019

recall (= TPR) precision

slide-30
SLIDE 30

Precision @ k

  • Assume only top k results are predicted positive
  • E.g. Netflix can only show you ~8 results on screen at a

time, we want most of these to be relevant

  • Example:
  • Prec @ 1 : 100%
  • Prec @ 2: 50%
  • Prec @ 8: 50%

31

Mike Hughes - Tufts COMP 135 - Spring 2019

Item ranking 1 2 3 4 5 6 7 8 Actual usage 1 1 1 1

slide-31
SLIDE 31

Cold Start Issue

32

Mike Hughes - Tufts COMP 135 - Spring 2019

  • New user entering the system
  • Hard for both content-based and matrix factors
  • Matching similar users
  • Trial-and-error
  • New item entering the system
  • Easy with per-user content-based recommendation
  • IF easy to get the item’s feature vector
  • Hard with matrix factorization
  • Trial-and-error
slide-32
SLIDE 32

Practical Issues in Real Systems

33

Mike Hughes - Tufts COMP 135 - Spring 2019

  • Recommendation system and users form a

loopy system

  • RS changes user’s behavior
  • User generate data for RS
  • User groups becoming more homogeneous
  • Youtube recommendation of politic videos:

recommend videos from the same camp

slide-33
SLIDE 33

Rec Sys Unit Objectives

  • Explain Recommendation Task
  • Predict which users will like which items
  • Explain two major types of recommendation
  • Content-based (have features for items/users)
  • Collaborative filtering (only have scores for item+user pairs)
  • Detailed Approach: Matrix Factorization + SGD
  • Evaluation:
  • Precision/recall for binary recs

34

Mike Hughes - Tufts COMP 135 - Spring 2019