Docsity

Matrix Factorization - Machine Learning and Pattern Recognition - Lecture Notes, Study notes of Machine Learning

Partial preview of the text

Download Matrix Factorization - Machine Learning and Pattern Recognition - Lecture Notes and more Study notes Machine Learning in PDF only on Docsity!

M

ATRIX FACTORIZATION METHODS FOR

COLLABORATIVE FILTERING

Docsity.com

What is collaborative filtering?

The goal of collaborative filtering (CF) is to infer userpreferences for items given a large but incompletecollection of preferences for many users.

For example:^ –

Suppose you infer from the data that most of the userswho like “Star Wars” also like “Lord of the Rings” anddislike “Dune”.

-

Then if a user watched and liked “Star Wars” you wouldrecommend him/her “Lord of the Rings” but not“Dune”.

Peferences can be explicit or implicit:^ –

Explicit preferences: ratings given to items by users.

-

Implicit preferences: which items were rented or boughtby users.

2

Docsity.com

Netflix Prize: In it for the money

Two years ago, Netflix has announced a movie ratingpredictions competition.

Whoever improves Netflix’s own baseline score by 10%will win the 1 million dollar prize.

The training data set consists of 100,480,507 ratings from480,189 randomly-chosen, anonymous users on 17,770movie titles. The data is very sparse, most users rate onlyfew movies.

Also, Netflix provides a test set containing 2,817,131user/movie pairs with the ratings withheld. The goal is topredict those ratings as accurately as possible.

4

Docsity.com

Course projects

We will provide you with a subset of the Netflix trainingdata: a few thousand users + a few thousand movies, sothat you can easily run your algorithms on CDF machines.

We will also provide you with a validation set. You willreport the achieved prediction accuracy on this validationset.

There will be two projects based on the following twomodels:^ –

Probabilistic Matrix Factorization (PMF)

-

Restricted Boltzmann Machines (RBM’s)

You can choose which model you would like to work on.

This tutorial will cover only PMF (the easy 4-5% onNetflix).

5

Docsity.com

Matrix factorization: notation

U

V

Features

Features

R

User

Movie

N Users

M Movies

T

Suppose we have

M

movies,

N

users, and integer rating

values from 1 to

K

.

Let

R

ij

be the rating of user

i

for movie

j

, and

U

R

D

×

N

,

V

R

D

×

M

be latent user and movie feature matrices.

We will use

U

i

and

V

j

to denote the latent feature vectors

for user

i

and movie

j

respectively.

7

Docsity.com

Matrix factorization: the non-probabilistic view

To predict the rating given by user

i

to movie

j

, we simply

compute the dot product between the correspondingfeature vectors:^ –

R

ij

U

T i

V

j

k

U

ik

V

jk

Intuition: for each user, we predict a movie rating bygiving the movie feature vector to a linear model.^ –

The movie feature vector can be viewed as the input.

-

The user feature vector can be viewed as the weightvector.

-

The predicted rating is the output.

-

Unlike in linear regression, where inputs are fixed andweights are learned, we learn

both

the weights

and

the

inputs (by minimizing squared error).

-

Note that the model is symmetric in movies and users.

8

Docsity.com

Learning (I)

U

V

j

i

R

ij

j=1,...,M

i=1,...,N

V σ

U σ

σ

MAP Learning: Maximize the log-

posterior over movie and userfeatures with fixed hyperparameters. •

Equivalent to minimizing the

sum-of-squared-errors withquadratic regularization terms: E

N ∑^ i

=

M ∑^ j

=

I

ij

R

ij

U

T i

V

j

2

λ

U 2

N ∑^ i

=

U

i

2 F ro

λ

V 2

M ∑^ j

=

V

j

2 F ro

λ

U

σ

2

/σ

(^2) U

,

λ

V

σ

2

/σ

(^2) V

, and

I

ij

if user

i

rated movie

j

and is 0 otherwise.

10

Docsity.com

Learning (II)

E

N ∑^ i

=

M ∑^ j

=

I

ij

R

ij

U

T i

V

j

2

λ

U 2

N ∑^ i

=

U

i

2 F ro

λ

V 2

M ∑^ j

=

V

j

2 F ro

Find a local minimum by performing gradient descent in U

and

V

.

If all ratings were observed, the objective reduces to theSVD objective in the limit of prior variances going toinfinity.

PMF can be viewed as a probabilistic extension of SVD,which works well even when most entries in

R

are

missing.

11

Docsity.com

Automatic Complexity Control for PMF (II)

U

V

j

i

R

ij

j=1,...,M

i=1,...,N

σ

Θ

V

U α Θ

α

V

U

Can use more sophisticated

regularization methods thansimple penalization of the Frobeniusnorm of the feature matrices:

priors with diagonal or fullcovariance matrices andadjustable means, or even mixture ofGaussians priors.

Using spherical Gaussian priors for feature

vectors leads to the standard PMF with λ

U

and

λ

V

chosen automatically.

Automatic selection of the hyperparameter values worked

considerably better than the manual approach that used avalidation set.

13

Docsity.com

Constrained PMF (I)

Two users that have rated similar movies are likely to havepreferences more similar than two randomly chosed users.

Make the prior for the user feature vector depend on themovies the user has rated.

This will force users who have seen the same (or similar)movies to have similar prior distributions for their featurevectors.

14

Docsity.com

Constrained PMF (III)

i Y

V

j

R

ij

j=1,...,M

U

i

i I

i=1,...,N

V σ

U σ

W k=1,...,M

W k σ

σ

The feature vector for user

i

:

U

i

Y

i

Mk

=

I

ik

W

k

Mk

=

I

ik

For standard PMF,

U

i

and

Y

i

are equal because the priormean is fixed at zero. •

The model:

p

R

Y, V, W, σ

2

N ∏ i

=

M ∏ j

=

[

N

R

ij

[

Y

i

Mk

=

I

ik

W

k

Mk

=

I

ik

]

T

V

j

, σ

2

]

I

ij

with

p

W

σ

W

M ∏ k

=

N

W

k

, σ

(^2) W

I)

16

Docsity.com

The Netflix Dataset

The Netflix dataset is large, sparse, and imbalanced.

The training set: 100,480,507 ratings from 480,189 users on17,770 movies.

The validation set: 1,408,395 ratings. The test set: 2,817,131user/movie pairs with ratings withheld.

The dataset is very imbalanced. The number of ratingsentered by each user ranges from 1 to over 15000.

Performance is assessed by submitting predictions toNetflix, which prevents accidental cheating since the testanswers are known only to Netflix.

17

Docsity.com

Experimental Results

1−

6−

−

−

−

−

−

−

>

0. 0.

0. 0.

1

1.

1. 1.

1.

Number of Observed Ratings

RMSE

PMF

ConstrainedPMF

Movie Average

1−

6−

−

−

−

−

−

−

>

5 0 20 15 10

Number of Observed Ratings

Users (%)

Left Panel: Performance of constrained PMF, PMF andmovie average algorithm that always predicts the averagerating of each movie.

Right panel: Distribution of the number of ratings per userin the training dataset.

19

Docsity.com

Experimental Results

0

5

10

15

20

25

30

35

40

45

50

55

60

0. 0.908 0.906 0.904 0.

0. 0.918 0.916 0.914 0.

0.

Epochs

RMSE

Constrained PMF(using Test rated/unrated id)

ConstrainedPMF

Performance of constrained PMF that uses an additionalrated/unrated information from the test dataset.

Netflix tells us in advance which user/movie pairs occurin the test set.

20

Docsity.com