Professional Documents
Culture Documents
Dense Methods
Sparse Methods
Handwritten Digits
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Definition
History
Properties
Definition
A WH
Non-negative Matrix Factorization (NMF)
Let A Rmn be matrix such that aij 0 for all i {1, . . . , m}
and j {1, . . . , n} (henceforth, A 0). Then for k min{m, n}
there exist W Rmk 0 and H Rkn 0 such that A WH.
Gives a rank-k approximation of A.
Factorization is not unique.
Can be approached as an optimization problem.
Implemented in MATLAB as nnmf().
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Definition
History
Properties
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Definition
History
Properties
Important Properties
A WH
Ax WHx = Wy
y = Hx.
A WH = WDD 1 H = W 0 H 0
D Rkk 0
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Definition
History
Properties
The Problem
A WH
Minimize f (W , H) = 21 kA WHk2F subject to:
W Rmk 0,
H Rkn 0.
(Resembles an optimization problem)
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Multiplicative Update
Alternating Least Squares
Dense Methods
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Multiplicative Update
Alternating Least Squares
A WH
Hij Hij
W T A ij
(W T WH)ij
Wij Wij
AH T
ij
(WHH T )ij
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Multiplicative Update
Alternating Least Squares
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Multiplicative Update
Alternating Least Squares
A WH
At each step solve:
min kWH Ak2F
H
min kH T W T AT k2F
W
such that
such that
H0
W 0
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Multiplicative Update
Alternating Least Squares
NMF/ANLS Algorithm
min kWH Ak2F
H
min kH T W T AT k2F
W
such that
such that
H0
W 0
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
Multiplicative Update
Alternating Least Squares
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
Sparse Methods
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
Sparse Methods
Two Popular Methods:
SNMF Right (SNMF/R) [forces sparseness in H].
SNMF Left (SNMF/L) [forces sparseness in W].
Both minimize f (W , H) subject to W 0 and H 0.
Both reduced to ANLS problems.
SNMF/R Objective Function:
n
X
1
f (W , H) = kA WHk2F + kW k2F +
kH(:, j)k21
2
j=1
X
1
f (W , H) = kA WHk2F + kHk2F +
kW (i, :)k21
2
i=1
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
SNMF/R
SNMF/R Objective Function:
n
X
1
f (W , H) = kA WHk2F + kW k2F +
kH(:, j)k21
2
j=1
ANLS Problem:
2
W
A
min
H
e1k
01n F
H
such that
H 0.
T
T 2
H
A
T
min
W
Ik
0km F
W
such that
W 0.
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
SNMF/L
SNMF/L Objective Function:
m
X
1
f (W , H) = kA WHk2F + kHk2F +
kW (i, :)k21
2
i=1
ANLS Problem:
2
W
A
min
H
Ik
0kn F
H
T 2
A
HT
T
W
min
e1k
01m F
W
such that
H 0.
such that
W 0.
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
SNMF/R
SNMF/L
Applications
Some Applications
SNMF/R
Molecular Cancer Class Discovery (Gao and Church, 2005).
Microarray Data Analysis (Kim and Park, 2007).
SNMF/L
Handwritten Digit Recognition (next slide!)
Others?
SNMF/R seems to be used almost exclusively in recent literature.
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
The Problem
Automatically classify a single unknown handwritten digit using a
database of known digits.
An Unknown Digit (Test Image)
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Image Representation
Images from the Database
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
The Database
7291 handwritten digits collected by the U.S. Postal Service.
Breakdown of Digits
Digit
0
1
2
3
4
5
6
7
8
9
1
Sample Size
1194
1005
731
658
652
556
664
645
542
644
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
| | | ... |
D5 = 5 5 5 ... 5
| | | ... |
D5 R256556
Notice there are many more columns than rows.
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
| | | ... |
D5 = 5 5 5 ... 5 ,
| | | ... |
d =?
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
A Classification Algorithm
Let d R256 be a test digit to classify and let i {0, 1, ..., 9}.
Form the Di matrices (as described before) for every i.
For every i, find i = minx kDi x dk22 .
Compute mini {i } and classify d as a digit of type i.
Q: How can we use NMF to do this efficiently?
A: Use properties of NMF and a low-rank approximation.
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Dik x
Wik Hik x
Wik y
y = Hik x
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Sample Size
359
264
198
166
200
160
170
147
166
177
Correct
353
257
175
141
178
148
163
129
149
167
Incorrect
6
7
23
25
22
12
7
18
17
10
Success Rate
98.329%
97.348%
88.384%
84.940%
89.000%
92.500%
95.882%
87.755%
89.759%
94.350%
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
0.01
0.1
1.0
10.0
100.0
1000.0
10000.0
min (nnz(Dik ))
542
529
269
198
218
157
157
max (nnz(Dik ))
1271
1199
1000
930
674
411
256
Run Time
181.37
179.19
147.50
124.60
135.45
151.08
131.97
Success Rate
92.676%
91.179%
90.533%
90.882%
88.490%
84.853%
80.668%
The run time is the sum of the time to obtain the factorizations and the time to test all 2007 digits.
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
Available at:
http://www.wwu.edu/depts/math/colloquium/Mazack slides.pdf
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
References
Y. Gao and G. Church. Improving molecular cancer class discovery
through sparse non-negative matrix factorization. Bioinformatics,
21:3970-3975, 2005.
D. Lee and H. Seung Algorithms for Non-negative Matrix
Factorization. Advances in Neural Information Processing Systems
13: Proceedings of the 2000 Conference. MIT Press. pp. 556-562,
2001.
H. Kim and H. Park. Sparse non-negative matrix factorizations via
alternating non-negativity-constrained least squares for microarray
data analysis. Bioinformatics, 23:1495-1502, 2007.
M. Mazack. Algorithms for Handwritten Digit Recognition.
Masters colloquium, Mathematics Department, Western
Washington University, 2009.
Michael Mazack
Introduction
Dense Methods
Sparse Methods
Handwritten Digits
The Problem
Image Representation
The Database
Algorithm Test Results
The End!
Michael Mazack