matrix factorisation (and dimensionality reduction)

23
Matrix Factorisation Thierry Silbermann, Data Scientist at Nubank (and dimensionality reduction)

Upload: hj-van-veen

Post on 03-Mar-2017

603 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Matrix Factorisation (and Dimensionality Reduction)

Matrix Factorisation

Thierry Silbermann, Data Scientist at Nubank

(and dimensionality reduction)

Page 2: Matrix Factorisation (and Dimensionality Reduction)

What is Matrix Factorisation?• For some domain, we have matrix that are:

very ‘big’

sparse

and don’t have any order

• Factoring it yield a set of:

More manageable

compact

and ordered matrices

Page 3: Matrix Factorisation (and Dimensionality Reduction)

Matrix Factorisation / Decomposition

• Singular Value Decomposition (SVD)

• Principal Component Analysis (PCA)

• Non-negative Matrix Factorisation (NMF)

• LU/QR/Cholskey decomposition

• etc…

Page 4: Matrix Factorisation (and Dimensionality Reduction)

SVD (Singular Value Decomposition)

• The singular value decomposition of an m × n matrix M is a factorisation of the form :

M = UΣV∗,

where U is an m × m unitary matrix,

Σ is an m × n rectangular diagonal matrix with non-negative real numbers on the diagonal (known as the singular values of M),

and V∗ (the transpose of V) is an n × n real or complex unitary matrix.

The m columns of U and the n columns of V are called the left-singular vectors and right-singular vectors of M, respectively.

Page 5: Matrix Factorisation (and Dimensionality Reduction)

Limitation SVD• One of the most general algorithm for

decomposition. SVD is an amelioration from eigenvalue decomposition (was only used with n x n matrix)

• Didn’t really reduce the space use to store our data.

• From a m x n (M) matrix, we end up with m x m (U), m x n (Σ) and n x n (V) matrices…

Page 6: Matrix Factorisation (and Dimensionality Reduction)

Matrix Factorisation• Using Non-Negative Matrix Factorisation

V ≈ WH

• V, W and H are all non-negative

• V is a n x m matrix

• W is a n x r matrix, H is a r x m matrix

• and r ≪ min(m, n)

Page 7: Matrix Factorisation (and Dimensionality Reduction)

How to decompose?

• Minimize with respect to W and H, subject to the constraints W, H ≥ 0.

• Multiplication Update Algorithm

• Alternating Least Square Algorithm

Page 8: Matrix Factorisation (and Dimensionality Reduction)

Matrix Factorisation

Page 9: Matrix Factorisation (and Dimensionality Reduction)

Toy example

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

Page 10: Matrix Factorisation (and Dimensionality Reduction)

Back to the math• We have a matrix of ratings we want to approximate:

• We need to construct P and Q by minimising:

• We have an optimisation problem:

• Update are then give by:

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

Page 11: Matrix Factorisation (and Dimensionality Reduction)

Easy to implement (for toy example)

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

Page 12: Matrix Factorisation (and Dimensionality Reduction)

Easy to implement

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

Page 13: Matrix Factorisation (and Dimensionality Reduction)
Page 14: Matrix Factorisation (and Dimensionality Reduction)

Example: Recommend given names to user of the name search engine ”Nameling*”

Page 15: Matrix Factorisation (and Dimensionality Reduction)

Example: Recommend given names to user of the name search engine ”Nameling*”

Page 16: Matrix Factorisation (and Dimensionality Reduction)

Example: Recommend given names to user of the name search engine ”Nameling*”

*http://nameling.net/

Page 17: Matrix Factorisation (and Dimensionality Reduction)
Page 18: Matrix Factorisation (and Dimensionality Reduction)
Page 19: Matrix Factorisation (and Dimensionality Reduction)
Page 20: Matrix Factorisation (and Dimensionality Reduction)
Page 21: Matrix Factorisation (and Dimensionality Reduction)
Page 22: Matrix Factorisation (and Dimensionality Reduction)

My own advertisement

• libFM (http://www.libfm.org/)

• https://thierrysilbermann.wordpress.com/2015/02/11/simple-libfm-example-part1/

Page 23: Matrix Factorisation (and Dimensionality Reduction)

Thank you