Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

23
Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R

Transcript of Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Page 1: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Nonnegative Matrix Factorization with Sparseness Constraints

S. Race MA591R

Page 2: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Introduction to NMF

Factor A = WH A – matrix of data

m non-negative scalar variables n measurements form the columns of A

W – m x r matrix of “basis vectors” H – r x n coefficient matrix

Describes how strongly each building block is present in measurement vectors

Page 3: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Introduction to NMF con’t

Purpose: “parts-based” representation of the data Data compression Noise reduction

Examples: Term – Document Matrix Image processing Any data composed of hidden parts

Page 4: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Introduction to NMF con’t

Optimize accuracy of solution: min || A-WH ||F where W,H ≥ 0 We can drop nonnegative constraints

min || A-(W.W)(H.H) ||

Many options for objective function Many options for algorithm

W,H will depend on initial choices Convergence is not always guaranteed

Page 5: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Common Algorithms

Alternating Least Squares Paatero 1994

Multiplicative Update Rules Lee-Seung 2000 Nature Used by Hoyer

Gradient Descent Hoyer 2004 Berry-Plemmons 2004

Page 6: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Why is sparsity important?

Nature of some data Text-mining Disease patterns

Better Interpretation of Results Storage concerns

Page 7: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Non-negative Sparse Coding I

Proposed by Patrik Hoyer in 2002 Add a penalty function to the

objective to encourage sparseness OBJ: Parameter λ controls trade-off

between accuracy and sparseness f is strictly increasing: f=Σ Hij works

Page 8: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Sparse Objective Function

The objective can always be decreased by scaling W up, H down Set W= cW and H=(1/c)H

Thus, alone the objective will simply yield the NMF solution

Constraint on the scale of H or W is needed Fix norm of columns of W or rows of H

Page 9: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Non-negative Sparse Coding I

Pros Simple, efficient Guaranteed to reach global minimum

using multiplicative update rule Cons

Sparseness controlled implicitly: Optimal λ found by trial and error

Sparseness only constrained for H

Page 10: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

NMF with sparseness constraints II

First need some way to define the sparseness of a vector

A vector with one nonzero entry is maximally sparse

A multiple of the vector of all ones, e, is minimally sparse

CBS Inequality How can we combine these ideas?

Page 11: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Hoyer’s Sparseness Parameter

sparseness(x)=

where n is the dimensionality of x

This measure indicates that we can control a vector’s sparseness by manipulating its L1 and L2 norms

Page 12: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.
Page 13: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Picture of Sparsity function for vectors w/ n=2

Page 14: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Implementing Sparseness Constraints

Now that we have an explicit measure of sparseness, how can we incorporate it into the algorithm?

Hoyer: at each step, project each column of a matrix onto the nearest vector of desired sparseness.

Page 15: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Hoyer’s Projection Algorithm

Problem: Given any vector, x, find the closest (in the Euclidean sense) non-negative vector s with a given L1 norm and a given L2 norm

We can easily solve this problem in the 3 dimensional case and extend the result.

Page 16: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Hoyer’s Projection Algorithm Set si=xi + (L1-Σxi)/n for all i Set Z={} Iterate

Set mi=L1/(n-size(Z)) if i in Z, 0 otherwise Set s=m+β(s-m) where β≥0 solves quadratic If s, non-negative we’re finished Set Z=Z U {i : si <0} Set si=0 for all i in Z Calculate c=(Σsi – L1)/(n-size(Z)) Set si=si-c for all i not in Z

Page 17: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

The Algorithm in words Project x onto hyperplane Σsi=L1

Within this space, move radially outward from center of joint constraint hypersphere toward point

If result non-negative, destination reached Else, set negative values to zero and

project to new point in similar fashion

Page 18: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

NMF with sparseness constraints

Step 1: Initialize W, H to random positive matrices

Step 2: If constraints apply to W or H or both, project each column or row respectively to have unchanged L2 norm and desired L1 norm

Page 19: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

NMF w/ Sparseness Algorithm

Step 3: Iterate If sparseness constraints on W apply,

Set W=W-μw(WH-A)HT

Project columns of W as in step 2 Else, take standard multiplicative step

If sparseness constraints on H apply Set H=H- μHWT(WH-A) Project rows of H as in step 2 Else, take standard multiplicative step

Page 20: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Advantages of New Method

Sparseness controlled explicitly with a parameter that is easily interpretted

Sparseness of W, H or both can be constrained

Number of iterations required grows very slowly with the dimensionality of the problem

Page 21: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Dotted Lines Represent Min and

Max Iterations

Solid Line shows average number

required

Page 22: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

An Example from Hoyer’s Work

Page 23: Nonnegative Matrix Factorization with Sparseness Constraints S. Race MA591R.

Text Mining Results

Text to Matrix Generator Dimitrios Zeimpekis and E. Gallopoulos University of Patras http://scgroup.hpclab.ceid.upatras.gr/scg

roup/Projects/TMG/ NMF with sparseness constraints from

Hoyer’s web page