Most of the work in matrix factorization techniques focus on dimensionality reduction: that is, the problem of finding two factor matrices that faithfully reconstruct the original matrix when multiplied together. However, I was interested in applying the exact same techniques to a separate task: text clustering.
A natural question is: why is matrix factorization a good technique to use for text clustering? Because it is simultaneously a clustering and a feature engineering technique: not only does it offer us a latent representation of the original data, but it also gives us a way to easily reconstruct the original data from the latent variables! This is something that latent Dirichlet allocation, for instance, cannot do.
I experimented with using these techniques to cluster subreddits. In a nutshell, nothing seemed to work out very well, and I opine on why I think that’s the case in this slide deck. This talk was delivered to a graduate-level course in frequentist machine learning.
Probabilistic and Bayesian
for Text Clustering
(a.k.a. A Series of Unfortunate Events)
tldr of Reddit project
(Skipping a lot of stuﬀ)
What is Reddit?
● Comprised of many communities,
○ Each has its own rules and
● 5th most popular website in the U.S.
● Free speech!
We have a way
to take subreddits and
tell a story about them
Non-negative matrix factorization
● Unsupervised learning.
● Strong notions of additivity.
○ Part-based decomposition!
● Gives us a latent space.
1. NMF always returns clusters, even if they are bad.
2. Short comments get clustered basically randomly.
Bayesian Machine Learning
in 3 Slides
“Yeah, that should be enough.”
tldr: Bayesianism and Bayes’ Theorem
● If something is unknown, it is a random variable,
and therefore has a probability distribution.
tldr: MCMC vs. VI
Markov-chain Monte Carlo
● Obtains samples from the posterior
● Exact (at least asymptotically)
● Approximates the posterior simply
(Disclaimer: I am not qualiﬁed to even pretend I know this stuff)
tldr: Why use Bayesian ML?
● Allows for expressive and informative priors
● Returns principled uncertainty estimates
● Can be conceptually easier than frequentist methods
1. NMF always returns clusters, even if they are bad
a. Returns principled uncertainty estimates
2. Short comments get clustered basically randomly
a. Allows for expressive and informative priors
Probabilistic Matrix Factorization
● Gaussian prior on the
rows (columns) of W (H).
○ Zero mean
○ Variance is a hyperparameter
● Likelihood is assumed to be
PMF doesn’t cluster very well…
In high dimensions, Gaussians are very weird.
● Gaussians are practically indistinguishable from uniform distributions
on the unit (hyper)sphere.
● Random Gaussian vectors are approximately orthogonal.
Try it with MCMC, instead of MAP!
● The authors use a Gibbs sampler. The general wisdom is to use a more
robust sampler, like the No-U-Turn Sampler (NUTS).
● NUTS returns the worst error possible: sampler diverges!
○ Posterior is very difﬁcult to sample from
■ High dimensional
■ Extremely multimodal
■ Possibly correlated…
Other criticisms of PMF
● Does the prior make sense?
○ Do we really expect word counts to be distributed from -∞ to ∞?
● Hyperparameter tuning sucks
○ And is fundamentally un-Bayesian!
○ The hyperparameters are unknown. Therefore, they should have
● Exactly the same as PMF except we place a (hyper)prior on the
parameters of the priors
○ The hyperprior is nontrivial…
■ Wishart prior on the covariance
(I experimented with LKJ priors)
■ Gaussian hyperprior on the mean
Tried running BPMF with MCMC
● Takes ~5 minutes to factorize a 200×10 matrix. Not encouraging!
● Even worse: sampler diverges again!
● Didn’t even bother trying it with VI
○ If you can’t even trust MCMC samples, why should we be able to
approximate the posterior?
○ A diverging sampler is a sign that the samples are ﬂat-out wrong.
We can’t get PMF/BPMF to work,
and when we can,
the clusters suck.
Do these methods even give good clusters?
● Two metrics for clustering: Calinski-Harabaz and Davies-Bouldin
○ Measure the well-separatedness of clusters…
not whether the clusters have any semantic meaning!
● NMF always produces better scores than PMF
● So PMF and BPMF produce better matrix reconstructions…
but fail to produce well-separated clusterings?
1. Fully Bayesian methods
are not well-suited
to big-data applications.
● Posterior is probably very difﬁcult to sample from:
○ Large dimensionality (posterior over matrices!)
○ Extremely multimodal
○ Possibly correlated
● There are some things to try…
○ Reparameterizing the model (e.g. noncentered parameterization)
○ Initializing the sampler better
● … but this deﬁnitely isn’t Bayesian home turf!
2. The literature focuses on
Isn’t there a diﬀerence?
Dimensionality reduction vs text clustering
NMF doesn’t just give us a latent
It also gives us an easy way to
reconstruct the original space.
So it both reduces the
dimensionality and clusters!
● Short comments are assigned the Gaussian prior.
○ This is probably not amenable to a good clustering!
● PMF/BPMF were born out of collaborative ﬁltering, but we are trying
to do clustering. These tasks are not obviously the same… are they?
Blog post and slide deck: