PCA Techniques in Machine Learning
PCA Techniques in Machine Learning
Martin Haugh
Department of Industrial Engineering and Operations Research
Columbia University
Email: [Link]@[Link]
Additional References: Christopher Bishop’s PRML, David Barber’s BRML, Hastie, Tibshirani and
Friedman’s ESL, Hastie, Tibshirani and Wainwright’s SLS and Chiang’s Networked Life
Principal Components Analysis
The Maximum Variance Formulation
The Minimum Reconstruction Error Formulation
The Singular Value Decomposition (SVD )
High-Dimensional Data
Some PCA Applications in Machine Learning & OR/FE
Data Compression: Digit Recognition
Data Compression: Eigen Faces
Reduced-Rank LDA
Financial Modeling
Nearest-Neighbor Classification
Latent Semantic Analysis (LSA)
Kernel PCA
Problems with Kernel PCA
Matrix Completion and Collaborative Filtering
Baseline Estimators
Neighborhood Methods
Matrix Factorization (Revisited)
The Netflix Prize
Reputation Systems & PageRank
Other Applications of PageRank
2 (Section 0)
Appendix: Non-Negative Matrix Factorization
Appendix: Probabilistic Latent Semantic Analysis (PLSA)
Appendix: Conditional PLSA
3 (Section 0)
Principal Components Analysis
Let x = (x1 , . . . , xd )> denote a d-dimensional random vector with
variance-covariance matrix, Σ.
(ii) each pi explains the largest percentage of the total variance that has not
already been explained by p1 , . . . , pi−1 .
4 (Section 1)
The Eigen Decomposition of a Matrix
In practice it is common to apply PCA to the normalized random variables so
that E[xi ] = 0 and Var(xi ) = 1
– achieved by subtracting the means from the original random variables and
dividing by their standard deviations.
– done to ensure that no one component of x can influence the analysis by
virtue of that component’s measurement units.
p = Γ> x. (2)
Note that:
(a) E[p] = 0 since E[x] = 0
(b) Cov(p) = Γ> Σ Γ = Γ> (Γ ∆ Γ> ) Γ = ∆
– so components of p are uncorrelated as desired
– and Var(pi ) = λi .
The matrix Γ> is called the matrix of factor loadings. We can invert (2) to obtain
x = Γp (3)
Pd Pd
If we take i=1 Var(pi ) = i=1 Var(xi ) to measure the total variability then by
(4) can interpret
Pk
i=1 λi
Pd
i=1 λi
as the percentage of total variability explained by first k principal components.
7 (Section 1)
The Maximum Variance Formulation
Let p1 = γ >
1 x be the 1
st
principal component. Can easily show that γ 1 solves
max Var(a> x)
a
subject to a> a = 1.
Then γ i solves
max Var(a> x)
a
subject to a> a = 1 (5)
a> γ j = 0, j = 1, . . . , i − 1. (6)
8 (Section 1)
The Minimum Reconstruction Formulation
We can also obtain the principal components of x by posing the problem as one
of minimizing the sum of squared differences between each sample vector, xi and
it’s representation, x̃i , in some lower M -dimensional sub-space
– here we let x1 , . . . , xn denote (centered) sample observations of x.
We have the following problem:
n X
d
" M
#2
X X
min xj,i − bj,k zk,i
B,Z
i=1 j=1 k=1
2
≡ min kX − BZkF (7)
B,Z
where Bj,k := bj,k is the basis in the M -dimensional subspace and Zk,i := zk,i is
the weighting of the ith sample on the k th element in the basis.
9 (Section 1)
The Minimum Reconstruction Formulation
Problem (7) is sufficient to identify a unique reconstruction point for each xi .
But it is not sufficient to identify a unique optimal B and Z. Why?
- hence we impose the constraint that B> B = IM .
But rotations still (why?) a problem
- recall U a rotation matrix if U> U = I
Choosing directions of maximal variance resolves this issue
- and then end up with solution where B = first M columns of Γ.
10 (Section 1)
u1
x2
xn
x
en
x1
Figure 12.2 from Bishop: Principal component analysis seeks a space of lower
dimensionality, known as the principal subspace and denoted by the magenta line,
such that the orthogonal projection of the data points (red dots) onto this
subspace maximizes the variance of the projected points (green dots). An
alternative definition of PCA is based on minimizing the sum-of-squares of the
projection errors, indicated by the blue lines.
The Singular Value Decomposition (SVD)
The singular value decomposition (SVD) of a d × n matrix X is given by
X = U D V> (8)
where:
1. U is d × d and U> U = Id
2. V is n × n and V> V = In
3. D is an d × n diagonal matrix of the positive singular values
We assume the decomposition has ordered the singular values so that the upper
left diagonal element of D has the largest singular value etc.
12 (Section 1)
The Singular Value Decomposition (SVD)
We can also use the singular value decomposition of a matrix to determine the
principal components. Why?
In practice we don’t know the true covariance matrix and have to make do with
the sample covariance matrix based on (centered) observations, x1 , . . . , xn .
The SVD is more general than the eigen decomposition and so PCA is often
performed via an SVD decomposition:
1. The eigen vectors are given by the U matrix of the SVD
2. The eigen values are the squares of the singular values from the SVD
Note also that we can use the SVD to approximate X using only the first M
singular values
X = U D V> ≈ UM DM V> M.
13 (Section 1)
Figure 14.21 from HTF: The best rank-two linear approximation to the
half-sphere data. The right panel shows the projected points with coordinates
given by U2 D2 , the first two principal components of the data.
High-Dimensional Data
In practice it is often the case that n << d
- e.g. have n = 500 images of d = 1000 × 1000 = 106 pixels
- can cause computational difficulties since computing eigen-decomposition
takes O(d3 ) operations.
This implies
1
XX> E = E∆
n−1
15 (Section 1)
High-Dimensional Data
Therefore have
1
X> XX> E = X> E∆. (9)
n−1
Reduced-rank LDA
Nearest neighbor classification
Financial modeling
Latent semantic analysis
Missing data and collaborative filtering / recommender systems.
17 (Section 2)
Data Compression: Digit Recognition Part I
Figure 14.22 from HTF displays 130 handwritten 3’s from a total of 658
- digitized as 16 × 16 grayscale images so can view them as points in R256 .
Figure 14.23 from HTF plots the first 2 principal components along with
images that are close to the vertices of the grid
- vertices are placed at 5%, 25%, 50%, 75% and 95% quantile points.
First component accounts for “lengthening of the lower tail of the three”.
Second component accounts for “character thickness”.
Equation (14.55) from HTF yields the 2-component model
Figure 14.24 from HTF displays the singular values (from the SVD)
compared with a randomized version of the data.
18 (Section 2)
Figure 14.22 from HTF: A sample of 130 handwritten 3’s shows a variety of
writing styles.
Figure 14.23 from HTF: Left panel: the first two principal components of the
hand- written threes. The circled points are the closest projected images to the
vertices of a grid, defined by the marginal quantiles of the principal components.
Right panel: The images corresponding to the circled points. These show the
nature of the first two principal components.
Figure 14.24 from HTF: The 256 singular values for the digitized threes,
compared to those for a randomized version of the data (each column of X was
scrambled).
Data Compression: Eigen Faces
Figure 15.5 from Barber: 100 training images. Each image consists of 92 × 112 = 10304 greyscale pixels.
The train data is scaled so that, represented as an image, the components of each image sum to 1. The
average value of each pixel across all images is 9.70 × 10−5 . This is a subset of the 400 images in the full
Olivetti Research Face Database.
22 (Section 2)
Figure 15.6 from Barber: (a): SVD reconstruction of the images in fig(15.5) using a combination of the 49
eigen-images. (b): The eigen-images are found using SVD of the images in fig(15.5) and taking the mean
and 48 eigenvectors with largest corresponding eigenvalue. The images corresponding to the largest
eigenvalues are contained in the first row, and the next 7 in the row below, etc. The root mean square
reconstruction error is 1.121 × 10−5 , a small improvement over PLSA (see fig(15.16)).
Reduced-Rank LDA
Recall the log-ratio in LDA was given by
P(G = k|X = x) π̂k 1 > −1
log = log − (x − µ̂k ) Σ̂ (x − µ̂k )
P(G = l|X = x) π̂l 2
1 > −1
+ (x − µ̂l ) Σ̂ (x − µ̂l ) (10)
2
We let Σ̂ = U DU > be the eigen decomposition of Σ̂ where U is m × m
orthornormal and D is a diagonal matrix of the positive eigen values of Σ̂.
Then used a change of variable with x∗ := D −1/2 U > x so that Cov (X ∗ ) = I.
Could then rewrite (10) as
P(G = k|X = x) π̂k 1 >
log = log − (x∗ − µ̂∗k ) (x∗ − µ̂∗k )
P(G = l|X = x) π̂l 2
1 >
+ (x∗ − µ̂∗l ) (x∗ − µ̂∗l ) (11)
2
where µ̂∗k and µ̂∗l are the centroid estimates for class k and l respectively under
the new coordinate system.
24 (Section 2)
Reduced-Rank LDA
The K centroids lie in a K − 1-dimensional subspace, HK−1 say, of Rm so we
can project points to HK−1 and then classify the projected points according to
the nearest centroid, after adjusting for log π̂k ’s.
27 (Section 2)
Nearest-Neighbor Classification
In nearest-neighbor classification it can be expensive to compute the distance
between data-points when dimensionality is high.
Can overcome this problem by using PCA to approximate distances.
Let Γ1 contain the first k principal components with k large enough so that
x = Γp ≈ Γ1 p1
28 (Section 2)
Figure 15.7 from Barber: Finding the optimal PCA dimension to use for
classifying hand-written digits using nearest neighbours. 400 training examples
are used, and the validation error plotted on 200 further examples. Based on the
validation error, we see that a dimension of 19 is reasonable.
Latent Semantic Analysis (LSA)
In the document analysis literature, PCA is called latent semantic analysis (LSA).
We assume:
1. There are d words in our dictionary, D
2. And n documents in the corpus.
Definition. The term-frequency, tfji , is the number of times that the word i
appears in document j divided by the number of words in document j, i.e.
#i,j
tfji := P
i #i,j
30 (Section 2)
The TF-IDF Representation
Definition. The inverse-document-frequency, idfi , is defined as
n
idfi := log .
# of documents that contain word i
X = [x1 · · · xn ]
31 (Section 2)
Latent Semantic Analysis (LSA)
LSA is simply a matter of applying PCA to (the variance-covariance matrix of) X
- with the interpretation that the principal directions, i.e. eigen vectors, now
define topics.
One weakness of LSA is that eigen vectors can have negative components
- but how can a word contribute negatively to a “topic”?
Topic modeling has been a “hot topic” in the machine learning community.
32 (Section 2)
Examples 15.4 from Barber
The dictionary, D, contains 10 words:
Some of the ailment articles are informal and use the word “flu” whereas others
use the more formal “influenza”.
min d(xf , xi ).
i
In this case it’s a good idea (why?) to scale each vector so that it has unit length
- leads to the equivalent cosine similarity
s(xf , xi ) := cos(θ)
35 (Section 2)
Figure 15.10 from Barber: (a): Two bag-of-word vectors. The Euclidean
distance between the two is large. (b): Normalised vectors. The Euclidean
distance is now related directly to the angle between the vectors. In this case two
documents which have the same relative frequency of words will both have the
same dissimilarity, even though the number of occurrences of the words is
different.
1 >
X̃X̃ e = λe.
n−1
>
After pre-multiplying by X̃ obtain
1 >
X̃ X̃f = λf (13)
n−1
>
where f := X̃ e
- an eigen equation that we have seen before!
37 (Section 3)
Kernel PCA
>
Now note that [X̃ X̃]i,j = φ(xi )> φ(xj ) := k(xi , xj ) := Ki,j .
p = x̃> e
1
= x̃> X̃f
λ(n − 1)
n
1 X
= k(x, xl )fl
λ(n − 1)
l=1
Straightforward to check that we can resolve this problem, i.e. center the φ(xi )’s,
by replacing K in (14) with K̂ where
n n
1X 1X
K̂i,j := Ki,j − k(xl , xj ) − k(xi , xd )
n n
l=1 d=1
n
1 X
+ 2 k(xl , xk ). (15)
n
l,k=1
39 (Section 3)
Problems with Kernel PCA
In regular PCA we can use the principal directions, i.e. eigen vectors
corresponding to the largest eigen values, to construct good approximations to x:
x = Γp ≈ Γ1 p1
Can also do this in kernel PCA but the approximation will lie in the higher
dimensional space RD
- hard to visualize or interpret this approximation
- would prefer to project it back to the original space, Rd
- but this is generally hard since the mapping x → φ(x) is non-linear.
One possible solution is to solve
>
min
0
(φ(x0 ) − z) (φ(x0 ) − z)
x
40 (Section 3)
x2 v1
φ1
x1
φ2
Figure 12.16 from Bishop: Schematic illustration of kernel PCA. A data set in
the original data space (left-hand plot) is projected by a nonlinear transformation
φ(x) into a feature space (right-hand plot). By performing PCA in the feature
space, we obtain the principal components, of which the first is shown in blue
and is denoted by the vector v1 . The green lines in feature space indicate the
linear projections onto the first principal component, which correspond to
nonlinear projections in the original data space. Note that in general it is not
possible to represent the nonlinear principal component by a vector in x space.
Figure 12.17 from Bishop: Example of kernel PCA, with a Gaussian kernel applied to a synthetic data set in
two dimensions, showing the first eight eigenfunctions along with their eigenvalues. The contours are lines
along which the projection onto the corresponding principal component is constant. Note how the first two
eigenvectors separate the three clusters, the next three eigenvectors split each of the cluster into halves, and
the following three eigenvectors again split the clusters into halves along directions orthogonal to the previous
splits.
Matrix Completion and Collaborative Filtering
Table 7.2 from Hastie, Tibshirani and Wainwright’s Statistical Learning with Sparsity (2015): Excerpt of
the Netflix movie rating data. The movies are rated from 1 (worst) to 5 (best). A symbol shaded grey
circles represents a missing value: a movie that was not rated by the corresponding customer.
43 (Section 4)
Matrix Completion and Collaborative Filtering
In many applications we are missing many / most of the elements of a matrix X.
Will discuss each of them but first we establish some baseline estimators.
44 (Section 4)
Baseline Estimators
A couple of obvious baseline estimators:
1. Set x̂ui = x̄, average of all ratings in the (training) data-set.
2. Introduce biases and set
x̂ui = x̄ + bu + bi (16)
where P
u xui
bi := − x̄ (17)
Mi
P
i xui
bu := − x̄ (18)
Mu
Mi = # users that rated movie i and Mu = # movies rated by user u.
3. Use (16) but choose bi ’s, bu ’s via
!
X 2
X X
min (xui − x̂ui ) + λ b2i + b2u .
bi ,bu
(u,i) i u
(16) seems sensible (why?) so will henceforth work with the residual matrix X̃
X̃u,i := x̃ui := xui − x̂ui .
45 (Section 4)
Neighborhood Methods
Will continue to use the movie-ratings matrix application to develop ideas.
Neighborhood methods rely on calculating nearest neighbors:
1. Two rows are near neighbors if corresponding users have similar taste in
movies.
2. Two columns are near neighbors if the corresponding movies obtained
similar ratings from users.
To compute nearest neighbors we need a distance / similarity metric.
Can use cosine similarity so
x̃>i x̃j
dij := cos(θij ) = p
||x̃i ||2 ||x̃j ||2
P
x̃ui x̃uj
= qP u P (19)
2 2
u x̃ui u x̃uj
where summation is only over users u that rated both movies i and j.
Can define duv for users u and v similarly.
46 (Section 4)
Neighborhood Methods
Given a fixed movie i can rank all other movies in descending order of |dij |.
Then top L movies in the ranking are the L nearest neighbors of movie i.
Yields new estimator
P
j∈L dij x̃uj
x̂N
ui = x̄ + bu + bi + P i (20)
j∈Li |dij |
| {z }
collaborative filtering term
Remarks:
1. Could just as easily use duv ’s rather than dij ’s and adjust (20) appropriately.
2. Still need to choose value of L and other obvious tweaks can be made.
3. Can use (20) to define new residual matrix X̃u,i
- and then start working on predicting missing elements of X̃u,i .
47 (Section 4)
Matrix Factorization Methods
General matrix factorization problem formulated as
subject to
Φ(M) ≤ r (22)
where || · ||F denotes Frobenius norm and Φ(·) a constraint function used to
encourage sparsity or regularization etc.
- many interesting problems obtained by varying Φ.
48 (Section 4)
PCA Revisited
e.g. Take Φ(M) = rank(M). Then solution to (21) is
where UDV> = SVD(X) and Dr is constructed from D by keeping just the first
r singular values.
Really just an equivalent version of (7) once you know the following:
Fact: Any rank r matrix M can be factored as M = BZ where B ∈ Rd×r is
orthogonal and Z ∈ Rr×n .
49 (Section 4)
Back to Matrix Completion
Let Ω ⊆ {1, . . . , d} × {1, . . . , n} denote observed entries of X. Then one version
of matrix completion problem is
X 2
min (xui − mui ) (24)
rank(M)≤r (u,i)∈Ω
r
!2
X X
≡ min xui − buk zki
B,Z
(u,i)∈Ω k=1
Algorithm #1: Find optimal Z in terms of B and then try to minimize over B.
50 (Section 4)
Matrix Completion: Alternating Least Squares
Algorithm #2 (ALTERNATING LEAST SQUARES):
Select an initial B̂ and then iterate the following two steps until convergence:
(i) Optimize over Z for given B̂. Let Ẑ be the optimal solution.
(ii) Optimize over B for given Ẑ. Let B̂ be the optimal solution.
51 (Section 4)
Figure 15.11 from Barber: Top: original data matrix X. Black is missing, white present. The data is
constructed from a set of only 5 basis vectors. Middle : X with missing data (80% sparsity). Bottom :
reconstruction found using svdm.m, SVD for missing data. This problem is essentially easy since, despite
there being many missing elements, the data is indeed constructed from a model for which SVD is
appropriate. Such techniques have application in collaborative filtering and recommender systems where one
wishes to ‘fill in’ missing values in a matrix.
Matrix Completion: Hard-Impute
Algorithm #3 (HARD-IMPUTE):
1. Use initial guess of missing values to obtain initial complete matrix Xcomp .
2. Compute a rank-r SVD of Xcomp , i.e. solve (23) to obtain X̂comp .
3. Use X̂comp to obtain new guess, Xcomp , of complete matrix.
4. Iterate steps 2 and 3 until convergence (which usually occurs but is not
guaranteed).
53 (Section 4)
A Convex Relaxation to Matrix Completion
Alternative formulation is based on the following convex relaxation of (24):
X 2
min (xui − mui ) + λ||M||∗ (25)
M
(u,i)∈Ω
54 (Section 4)
A Convex Relaxation to Matrix Completion
Definition. Let W = UDV> be the SVD of a rank-r matrix W. Then the
soft-threshold operator Sλ (·) is given by
where
Dλ := diag (s1 − λ)+ , . . . , (sr − λ)+ .
and
⊥ xui , if (u, i) 6∈ Ω
PΩ (X) ui :=
0, otherwise.
55 (Section 4)
Matrix Completion: Soft-Impute
Algorithm #4 (SOFT-IMPUTE):
Initialize Xold = 0, set X to be any completion of the matrix and iterate until
convergence:
1. Compute
X̂λ := Sλ PΩ (X) + PΩ⊥ (Xold )
Many other interesting instances (and generalizations) of (21) and (22) including
sparse PCA, robust PCA.
e.g. Decompose X into sum of low-rank and sparse components by solving
1
min ||X − (L + S)||2F + λ1 ||L||∗ + λ2 ||S||1
L ∈ Rd×n 2
S ∈ Rd×n
57 (Section 4)
The Netflix Prize
Define the root mean-squared error (RMSE) to be
v
(xui − x̂ui )2
uX
RMSE := t .
u
C
(u,i)
In 2006 Netflix launched a competition with a $1m prize – the Netflix Prize.
Goal of competition was to develop a recommender system that improved
Cinematch (Netflix’s proprietary system) by at least 10%.
If goal not achieved in 3 years, consolation prize of $50k awarded to best team.
Progress prizes of $50k also awarded each year.
Competition sparked huge interest — over 5k teams and 44k submissions!
Data from period 1999 to 2005 on 480k users and 17,770 movies.
Each movie rated by more than 5,000 users on average.
Each user rated more than 200 movies on average.
58 (Section 4)
The Netflix Data-Set
Figure 4.1 from Chiang’s Networked Life: 20 Questions and Answers (2012): The Netflix Prize’s four
data sets. The training set and probe set were publicly released, whereas the quiz set and test set were
hidden from the public and known only to Netflix. The probe, quiz, and test sets had similar statistical
properties, but the probe set could be used by each competing team as often as they want, and the quiz set
at most once a day. The final decision was based on comparison of the RMSE on the test set.
Figure 7.2 from Hastie, Tibshirani and Wainwright’s Statistical Learning with Sparsity (2015): Left:
Root-mean-squared error for the Netflix training and test data for the iterated-SVD (HARD-IMPUTE) and
the convex spectral-regularization algorithm (SOFT-IMPUTE). Each is plotted against the rank of the
solution, an imperfect calibrator for the regularized solution. Right: Test error only, plotted against training
error, for the two methods. The training error captures the amount of fitting that each method performs.
The dotted line represents the baseline “Cinematch” score.
60 (Section 4)
And the Winner Is ...
Turns out that 10% was an excellent choice by Netflix:
Relatively easy to improve on Cinematch by approx 8%
But much(!) harder to improve by 10%.
61 (Section 4)
Source: Matrix Factorization Techniques for Recommender Systems by Koren, Bell and Volinsky, Computer
(2009).
Reputation Systems
The ever increasing amount of online activity and data has been accompanied by
the decentralization of control.
For example:
1. IMDB and Rotten Tomatoes help us choose what movies to watch.
2. How do we decide what sellers to trust on Ebay?
3. Who should we follow on Twitter?
4. How does Google figure out the importance of web-pages?
5. Why is Yelp so popular?
63 (Section 5)
Reputation Systems
An important problem is in figuring out who or what pages are the “best”
- clearly this is also a dimension reduction problem!
Any problems with this? Yes ... but how do reputations in the real world work?
64 (Section 5)
Google’s Naive PageRank Algorithm
Consider the web and suppose there are a total of d pages.
Say i → j if page i links to page j and define c(i) := # of out-links from page i.
Another (less important) issue with defining web-page reputations in this way is
that it is easily “gamed” by just a couple of web-pages that collude.
See for example “Making Eigenvector-Based Reputation Systems Robust to
Collusion” (2004) by Zhang, Goel, Govindan, Mason and Van Roy.
Google’s PageRank Algorithm
We resolve the uniqueness problem (and make collusion harder!) by instead
assuming a transition matrix Q̄ where
Q̄i,j := (1 − )Qi,j + >0 (27)
d
for 0 < < 1. Can write (27) equivalently as
>
Q̄ := (1 − )Q + 11 (28)
d
where 1 is a d × 1 vector of 1’s.
Note that (28) implies that Q̄ is irreducible and therefore has a unique
stationary distribution, µ, satisfying
µ = µQ̄. (29)
Can interpret the resulting Markov chain as one where with probability we
choose a new web-page randomly from the entire universe of web-pages and with
probability 1 − we click randomly on a link on the current page
- the random walk interpretation.
67 (Section 5)
Google’s PageRank Algorithm
µ gives the page-ranks of all the web-pages.
If we run the Markov chain for a sufficiently long time then proportion of time we
spend on page i is µ(i).
Page-rank or “importance” of a page is therefore captured by importance of the
pages that link to it
- so still a circular definition of reputation!
68 (Section 5)
Using Power Iteration to Estimate PageRank
Power iteration is very simple:
1. Choose an initial vector, µ0 . (Easy choice is µ0 = 1/d.)
2. Then iterate µt+1 = µt Q̄ for t = 1, . . . until convergence.
Question: Is convergence guaranteed?
Answer: Yes!
Pd
Proof: Let ∆t := i=1 |µt (i) − µ(i)| where µ is the solution to (29).
Using the triangle inequality it is easy to see that
X |µt (j) − µ(j)|
|µt+1 (i) − µ(i)| ≤ (1 − ) (30)
c(j)
j: j links to i
Over the years the PageRank system has adapted and heuristics added
- in part to counter attempts at collusion and manipulation.
While the specific details are private it is very likely that PageRank still plays the
key role in Google’s search algorithms.
70 (Section 5)
PageRank and Search
Question: How might you use PageRank as part of a search system?
Here’s how ...
1. First compute the PageRank of all web-pages and store it in descending
order of importance
- just like a book with the 1st page having the highest PageRank, the 55th
page having the 55th highest PageRank etc.
2. A reverse index for all commonly searched terms is also computed and stored
- this is exactly like an index at the back of a book telling you what pages
important terms appear on.
Question: How do you handle a multiple term search, e.g. “dog” and “pony”?
71 (Section 5)
Other Applications / Extensions of PageRank
The ordering returned by PageRank can easily be adapted to reflect a preference
for a specific subset, C say, of web-pages.
Can do this by changing the algorithm so that w.p. we choose a new web-page
randomly from C and w.p. 1 − we click randomly on a link on the current page
- is known as personalized PageRank.
PageRank can be applied in most network settings where links between nodes
indicate some sort of preference. Other examples include:
2. Networks can also be created out of users and tweets on Twitter with links
added to identify creators of tweets and followers. Can use such a system to
identify influential people and make recommendations to users.
72 (Section 5)
Appendix: Non-Negative Matrix Factorization
Non-negative matrix factorization is an alternative to PCA where the matrix
components are required to be non-negative
- useful for modeling non-negative data, e.g. images, text, trading volume etc.
X ≈ WH
73 (Section 6)
Appendix: Non-Negative Matrix Factorization
L(W, H) is not convex and therefore does not have a unique maximum
- instead must search for a good local maximum.
Figure 14.33 from HTF shows NNMF, vector quantization and PCA applied to a
database of n = 2, 429 images
- each image represented by a 19 × 19 matrix of pixels so d = 381
- positive values are represented by black pixels
- negative values are represented by red pixels.
Note how NNMF represents faces with a set of basis images each of which
resembles a face part.
74 (Section 6)
Figure 14.33 from HTF: Non-negative matrix factorization (NMF), vector quantization (VQ, equivalent to
k-means clustering) and principal components analysis (PCA) applied to a database of facial images. Details
are given in the text. Unlike VQ and PCA, NMF learns to represent faces with a set of basis images
resembling parts of faces.
Figure 14.34 from HTF: Non-uniqueness of the non-negative matrix
factorization. There are 11 data points in two dimensions. Any choice of the
basis vectors h1 and h2 in the open space between the coordinate axes and data,
gives an exact reconstruction of the data.
Often claimed that the basis in NNMF will be much easier to interpret in problem
applications where it makes sense for basis elements to be non-negative
X ≈ WH
77 (Section 6)
Appendix: Probabilistic Latent Semantic Analysis (PLSA)
May then seek a decomposition where
X
P(U = i, V = j) ≈ P̃(U = i | Z = k) P̃(V = j | Z = k)P̃(Z = k) (34)
| {z }| {z }
k
Wik Hkj
≡ P̃(U = i, V = j)
where Z is a hidden or latent random variable and we’re assuming U and V are
conditionally independent given Z.
Note each column of W now represents a possible value of Z.
There are EM-style algorithms for finding W and H but only convergence to a
local minimum is assured
- see Section 15.6 of Barber for details.
≡ P̃(U = i, | V = j)
80 (Section 6)
Appendix: Discovering the Basis (E.G. 15.7 in Barber)
Images displayed in Fig. 15.15(a) created from 4 base images in Fig. 15.15(b).
Each base image is positive and scaled so that the sum of the pixels is 1; i.e. for
k = 1, . . . , 4 X
P(U = i | Z = k) = 1
i
Goal: given only the training images, reconstruct the 4 basis images.
Results are shown in Figure 15.15(c) and are very good
- but number of elements in basis, i.e. 4, was assumed to be known!
81 (Section 6)
Figure 15.15 from Barber: (a) Training data, consisting of a positive (convex)
combination of the base images. (b): The chosen base images from which the
training data is derived. (c): Basis learned using conditional PLSA on the
training data. This is virtually indistinguishable from the true basis. (d):
Eigenbasis (sometimes called ‘eigenfaces’).
Can now perform PLSA to discover citation-topics. See e.g. 15.9 in Barber.
2. Modeling the Web
Have a collection of web-sites indexed by i.
If web-site j points to web-site i then set Cij = 1. Otherwise set Cij = 0
– yields a directed graph of web-site to web-site links.
A typical web-site will only “discuss” a small number of topics so a PLSA
decomposition might be useful for determining latent topics and authoritative
web-sites.
See Section 15.6.3 of Barber for further details and references.
84 (Section 6)