29
Matrix Factorisation / Spotify Simon Kalt & Jannis Fey Seminar: Music Information Retrieval

Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

  • Upload
    others

  • View
    22

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Matrix Factorisation / SpotifySimon Kalt & Jannis Fey

Seminar: Music Information Retrieval

Page 2: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Outline● Recommender Systems

● A Basic Matrix Factorization Model

● Spotify

● Improvements for the Matrix Factorization Model

● Netflix Prize Competition

2

Page 3: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Recommender Systems

3

Page 4: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Content Filtering● Create a profile for each user and a representation for each product

● Match profiles of users with products

● Requires external information → needs to be collected

● Used for Pandora “Music Genome Project”

4

Page 5: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Collaborative Filtering● Generate recommendations based on ratings or usage

● No external information necessary

● Relationships between users

● Dependencies between products

→ Associate users with new products

● Problem: Cold Start

5

Page 6: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Explicit vs. Implicit Feedback

● explicit feedback

○ explicit user input

Netflix: 1 – 5 Stars

● implicit feedback

○ observing user behavior

Spotify: 1 if streamed, 0 if not

? 3 5 ?

1 ? ? 1

2 ? 3 2

? ? ? 5

5 2 ? 4

Movies

Users

Chris

Inception

1 1 0 0

0 1 1 1

0 1 0 1

1 0 1 1

0 0 1 0

Songs

Users

6

Page 7: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Neighborhood Models● Relationships between users with similar tastes

● Example:

○ User likes a movie

○ Find users who liked the same movie

○ Find movies a lot of them liked

○ Recommend the movie that has the most “likes”

7

Page 8: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Latent Factor Models● Score users and movies in certain “factors”

● Factors measure dimensions like “comedy” or “action”

● Users: how much they like a movie that scores high in this factor

8

Page 9: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Matrix Factorization

1 2 3 5

2 4 8 12

3 6 7 13

R =

R1 R2 R3 R4

R1 = 1*R1 + 0*R3R2 = 2*R1 + 0*R3R3 = 0*R1 + 1*R3R4 = 2*R1 + 1*R3

1 3

2 8

3 7

P =1 2 0 2

0 0 1 1Q = P*Q = R

n by m Matrix

n by r

r by m R1 R3

9

Page 10: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

A Basic Matrix Factorization Model

10

Page 11: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

What does Matrix Factorization do?● Characterizes items and users by vectors of factors

● Matrix with two dimension

○ First representing users

○ Second representing items of interest

● Factorize matrix into two matrices, one for users, one for items

● High correspondence between item and user factors

→ recommendation

11

Page 12: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Example5 3 ? 1

4 ? ? 1

1 1 ? 5

1 ? ? 4

? 1 5 4

R =

● N = 4 User

● M = 5 Items (e.g. movies)

● K = latent features (e.g. genre)

● ? = unknown value (set to 0)

Task:

● find Matrix P and Q such that

R ≈ P * Q

T

● R: N x M matrix

● P: N x K matrix

● Q: K x M matrix

12

Page 13: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Example5 3 0 1

4 0 0 1

1 1 0 5

1 0 0 4

0 1 5 4

R =

r

ui

= q

i

T

p

u

● each item i is associated with a vector q

i

● each user u is associated with a vector p

u

● r

ui

represents user’s overall interest in the

item’s characteristics

pu

qi

13

Page 14: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Example5 3 0 1

4 0 0 1

1 1 0 5

1 0 0 4

0 1 5 4

R =

Goal:

● approximate the matrix R

● minimize the regularized squared

error on known ratings

14

Page 15: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Example5 3 0 1

4 0 0 1

1 1 0 5

1 0 0 4

0 1 5 4

R =

● minimize squared error iteratively

● approximate R step-by-step

4,97 2,98 2,18 0,98

3,97 2,40 1,97 0,99

1,02 0,93 5,32 4,93

1,00 0,85 4,49 3,93

1,36 1,07 4,89 4,12

5000 steps

15

Page 16: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Learning Algorithm● Alternating least squares (ALS)

● q

i

and p

u

are unknown

○ can not be solved optimally

● rotate between fixing the q

i

’s and fixing the p

u

’s

○ problem becomes quadratic

○ solving a least-squares problem

● favorable if the system can use parallelization

16

Page 17: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Spotify

17

Page 18: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

18

Hadoop at Spotify 2009

Page 19: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

19

2014: 700 Nodes in London data center

Page 20: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Improvements for the Matrix Factorization Model

20

Page 21: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Adding Biases● Some users generally rate higher

● Some movies generally receive higher ratings

● Baseline prediction b

ui

for an unknown rating:

b

ui

= µ + b

u

+ b

i

21

Page 22: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Adding Biases● Learn b

u

and b

i

by solving the least squares problem

22

Page 23: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Temporal Dynamics● Model temporal variation of

○ User preferences: p

u

(t)

○ Item and user biases: b

i

(t), b

u

(t)

● User’s preferences may change

● Movies are more popular at certain times

● User’s baseline rating may change

● Time sensitive baseline predictor b

ui

on a given day t

ui

b

ui

= µ + b

u

(t

ui

) + b

i

(t

ui

)

23

Page 24: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Improvements for the Matrix Factorization Model

24

Page 25: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Netflix Prize Competition

25

Page 26: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Netflix Prize Competition● 2006 Netflix announced a contest to improve its recommender system

● Training set: 100 million ratings, 500.000 customers, 17.000 movies

● Teams submit predicted ratings for given test set of 3 million ratings

● Netflix calculates the root-mean-square error (RMSE) on truth ratings

● $1 million for improvement of 10% on Netflix’s algorithm

● $50.000 for the first team, if no team reaches 10%

26

Page 27: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

The Winners● 2007: KorBell

○ RMSE: 0,8723

○ Improvement: 8,42%

● 2008: BellKor in BigChaos

○ RMSE: 0,8624

○ Improvement: 9,27%

● 2009: BellKor's Pragmatic Chaos

○ RMSE: 0,8567

○ Improvement: 10.06%

27

Page 28: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

28

Page 29: Matrix Factorisation / Spotify · Spotify Improvements for the Matrix Factorization Model Netflix Prize Competition 2. Recommender Systems 3. Content Filtering Create a profile for

Sources1. Advances in Collaborative Filtering

○ Yehuda Koren, Robert Bell

2. Matrix Factorization: A Simple Tutorial and Implementation in Python

○ Albert Au Yeung

○ http://www.quuxlabs.com/blog/2010/09/matrix-factorization-a-simple-tutorial-and-implementation-in-python/

3. Collaborative Filtering with Spark

○ Christopher Johnson (Spotify)

○ https://www.youtube.com/watch?v=3LBgiFch4_g

29