Learning Topic Models - Going beyond SVD

Sanjeev Arora, Rong Ge, Ankur Moitra

Introduction

Developing tools for automatic comprehension and classification of data —web pages, newspaper articles, images, genetic sequences, user ratings — is a holy grail of machine learning. Topic Modeling is an approach that has proved successful in all of the aforementioned settings, though for concreteness here we will focus on uncovering thematic structure of a corpus of documents (see e.g. , ).

In order to learn structure one has to posit the existence of structure, and in topic models one assumes a generative model for a collection of documents. Specifically, each document is represented as a vector of word-frequencies (the bag of words representation). Seminal papers in theoretical CS (Papadimitriou et al. ) and machine learning (Hofmann’s Probabilistic Latent Semantic Analysis ) suggested that documents arise as a convex combination of (i.e. distribution on) a small number of topic vectors, where each topic vector is a distribution on words (i.e. a vector of word-frequencies). Each convex combination of topics thus is itself a distribution on words, and the document is assumed to be generated by drawing NN independent samples from it. Subsequent work makes specific choices for the distribution used to generate topic combinations —the well-known Latent Dirichlet Allocation (LDA) model of Blei et al hypothesizes a Dirichlet distribution (see Section 4).

In machine learning, the prevailing approach is to use local search (e.g. ) or other heuristics in an attempt to find a maximum likelihood fit to the above model. For example, fitting to a corpus of newspaper articles may reveal 5050 topic vectors corresponding to, say, politics, sports, weather, entertainment etc., and a particular article could be explained as a (1/2,1/3,1/6)(1/2,1/3,1/6)-combination of the topics politics, sports, and entertainment. Unfortunately (and not surprisingly), the maximum likelihood estimation is NPNP-hard (see Section 6) and consequently when using this paradigm, it seems necessary to rely on unproven heuristics even though these have well-known limitations (e.g. getting stuck in a local minima ).

The work of Papadimitriou et al (which also formalized the topic modeling problem) and a long line of subsequent work have attempted to give provable guarantees for the problem of learning the model parameters assuming the data is actually generated from it. This is in contrast to a maximum likelihood approach, which asks to find the closest-fit model for arbitrary data. The principal algorithmic problem is the following (see Section 1.1 for more details):

Meta Problem in Topic Modeling: There is an unknown topic matrix AA with nonnegative entries that is dimension n×rn\times r, and a stochastically generated unknown matrix WW that is dimension r×mr\times m. Each column of AWAW is viewed as a probability distribution on rows, and for each column we are given N≪nN\ll n i.i.d. samples from the associated distribution.

Goal: Reconstruct AA and parameters of the generating distribution for WW.

The challenging aspect of this problem is that we wish to recover nonnegative matrices A,WA,W with small inner-dimension rr. The general problem of finding nonnegative factors A,WA,W of specified dimensions when given the matrix AWAW (or a close approximation) is called the Nonnegative Matrix Factorization (NMF) problem (see , and for a longer history) and it is NP-hard . Lacking a tool to solve such problems, theoretical work has generally relied on the Singular Value Decomposition (SVD) which given the matrix AWAW will instead find factors U,VU,V with both positive and negative entries. SVD can be used as a tool for clustering – in which case one needs to assume that each document has only one topic. In Papadimitriou et al this is called the pure documents case and is solved under strong assumptions about the topic matrix AA (see also and which uses the method of moments instead). Alternatively, other papers use SVD to recover the span of the columns of AA (i.e. the topic vectors) , , , which suffices for some applications such as computing the inner product of two document vectors (in the space spanned by the topics) as a measure of their similarity.

These limitations of existing approaches —either restricting to one topic per document, or else learning only the span of the topics instead of the topics themselves—are quite serious. In practice documents are much more faithfully described as a distribution on topics and indeed for a wide range of applications one needs the actual topics and not just their span – such as when browsing a collection of documents without a particular query phrase in mind, or tracking how topics evolve over time (see for a survey of various applications). Here we consider what we believe to be a much weaker assumption – separability. Indeed, this property has already been identified as a natural one in the machine learning community and has been empirically observed to hold in topic matrices fitted to various types of data .

Separability requires that each topic has some near-perfect indicator word – a word that we call the anchor word for this topic— that appears with reasonable probability in that topic but with negligible probability in all other topics (e.g., “soccer” could be an anchor word for the topic “sports”). We give a formal definition in Section 1.1. This property is particularly natural in the context of topic modeling, where the number of distinct words (dictionary size) is very large compared to the number of topics. In a typical application, it is common to have a dictionary size in the thousands or tens of thousands, but the number of topics is usually somewhere in the range from 5050 to 100100. Note that separability does not mean that the anchor word always occurs (in fact, a typical document may be very likely to contain no anchor words). Instead, it dictates that when an anchor word does occur, it is a strong indicator that the corresponding topic is in the mixture used to generate the document.

Recently, we gave a polynomial time algorithm to solve NMF under the condition that the topic matrix AA is separable . The intuition that underlies this algorithm is that the set of anchor words can be thought of as extreme points (in a geometric sense) of the dictionary. This condition can be used to identify all of the anchor words and then also the nonnegative factors. Ideas from this algorithm are a key ingredient in our present paper, but our focus is on the question:

What if we are not given the true matrix AWAW, but are instead given a few samples (say, 100100 samples) from the distribution represented by each column?

The main technical challenge in adapting our earlier NMF algorithm is that each document vector is a very poor approximation to the corresponding column of AWAW —it is too noisy in any reasonable measure of noise. Nevertheless, the core insights of our NMF algorithm still apply. Note that it is impossible to learn the matrix WW to within arbitrary accuracy. (Indeed, this is information theoretically impossible even if we knew the topic matrix AA and the distribution from which the columns of WW are generated.) So we cannot in general give an estimator that converges to the true matrix WW, and yet we can give an estimator that converges to the true topic matrix AA! (For an overview of our algorithm, see the first paragraph of Section 3.)

We hope that this application of our NMF algorithm is just a starting point and other theoretical results will start using NMF as a replacement for SVD – just as NMF has come to replace SVD in several applied settings.

Now we precisely define the topic modeling (learning) problem which was informally introduced above. There is an unknown topic matrix AA which is dimension n×rn\times r (i.e. nn is the dictionary size) and each column of AA is a distribution on [n][n]. There is an unknown r×mr\times m matrix WW whose each column is itself a distribution (aka convex combination) on [r][r]. The columns of WW are i.i.d. samples from a distribution T\mathcal{T} which belongs to a known family, e.g., Dirichlet distributions, but whose parameters are unknown. Thus each column of AWAW (being a convex combination of distributions) is itself a distribution on [n][n], and the algorithm’s input consists of NN i.i.d. samples for each column of AWAW. Here NN is the document size and is assumed to be a constant for simplicity. Our algorithm can be easily adapted to work when the documents have different sizes.

The algorithm’s running time will necessarily depend upon various model parameters, since distinguishing a very small parameter from imposes a lower bound on the number of samples needed. The first such parameter is a quantitative version of separability, which was presented above as a natural assumption in context of topic modeling.

An n×rn\times r matrix AA is pp-separable if for each ii there is some row π(i)\pi(i) of AA that has a single nonzero entry which is in the ithi^{th} column and it is at least pp.

The next parameter measures the lowest probability with which a topic occurs in the distribution that generates columns of WW.

Finally, we require that topics stay identifiable despite sampling-induced noise. To formalize this, we define a matrix that will be important throughout this paper:

If T\mathcal{T} is the distribution that generates the columns of WW, then R(T)R(\mathcal{T}) is defined as an r×rr\times r matrix whose (i,j)(i,j)th entry is E[XiXj]E[X_{i}X_{j}] where X1,X2,...XrX_{1},X_{2},...X_{r} is a vector chosen from T\mathcal{T}.

There is a polynomial time algorithm that learns the parameters of a topic model if the number of documents is at least

where the three numbers a,p,γa,p,\gamma are as defined above. The algorithm learns the topic-term matrix AA up to additive error ϵ\epsilon. Moreover, when the number of documents is also larger than O(log⁡r⋅r2ϵ2)O\left(\frac{\log r\cdot r^{2}}{\epsilon^{2}}\right) the algorithm can learn the topic-topic covariance matrix R(T)R(\mathcal{T}) up to additive error ϵ\epsilon.

As noted earlier, we are able to recover the topic matrix even though we do not always recover the parameters of the column distribution T\mathcal{T}. In some special cases we can also recover the parameters of T\mathcal{T}, e.g. when this distribution is Dirichlet, as happens in the popular Latent Dirichlet Allocation (LDA) model . In Section 4.1 we compute a lower bound on the γ\gamma parameter for the Dirichlet distribution, which allows us to apply our main learning algorithm, and also the parameters of T\mathcal{T} can be recovered from the co-variance matrix R(T)R(\mathcal{T}) (see Section 4.2).

Recently the basic LDA model has been refined to allow correlation among different topics, which is more realistic. See for example the Correlated Topic Model (CTM) and the Pachinko Allocation Model (PAM) . A compelling aspect of our algorithm is that it extends to these models as well: we can learn the topic matrix, even though we cannot always identify T\mathcal{T}. (Indeed, the distribution T\mathcal{T} in the Pachinko is not even identifiable: two different sets of parameters can generate exactly the same distribution)

(i) We rely crucially on separability. But note that this assumption is weaker in some sense than the assumptions in all prior works that provably learn the topic matrix. They assume a single topic per document, which can be seen as a strong separability assumption about WW instead of AA —in every column of WW only one entry is nonzero. By contrast, separability only assumes a similar condition for a negligible fraction —namely, rr out of nn— of rows of AA. Besides, it is found to actually hold in topic matrices found using current heuristics. (ii) Needless to say, existing theoretical approaches for recovering topic matrix AA couldn’t handle topic correlations at all since they only allow one topic per document. (iii) We remark that prior approaches that learn the span of AA instead of AA needed strong concentration bounds on eigenvalues of random matrices, and thus require substantial document sizes (on the order of the number of words in the dictionary!). By contrast we can work with documents of O(1)O(1) size.

Tools for (Noisy) Nonnegative Matrix Factorization

If BB does not have row sums of one then Γ(B)\Gamma(B) is equal to Γ(DB)\Gamma(DB) where DD is the diagonal matrix such that DBDB has row sums of one.

For example, if the rows of BB have disjoint support then Γ(B)=1\Gamma(B)=1 and in general the quantity Γ(B)\Gamma(B) can be thought of a measure of how close two distributions on disjoint sets of rows can be. Note that, if xx is an nn-dimensional real vector, ∥x∥2≤∥x∥1≤n∥x∥2\|x\|_{2}\leq\|x\|_{1}\leq\sqrt{n}\|x\|_{2} and hence (if σmin(B)\sigma_{min}(B) is the smallest singular value of BB), we have:

In our previous work on nonnegative matrix factorization we defined a different measure of “distance” from singular which is essential to the polynomial time algorithm for NMF:

The following claim clarifies the interrelationships of these latter condition numbers.

2 Noisy Nonnegative Matrix Factorization under Separability

Algorithm for Learning a Topic Model: Proof of Theorem 1.4

First it is important to understand why separability helps in nonnegative matrix factorization, and specifically, the exact role played by the anchor words. Suppose the NMF algorithm is given a matrix ABAB. If AA is pp-separable then this means that AA contains a diagonal matrix (up to row permutations). Thus a scaled copy of each row of BB is present as a row in ABAB. In fact, if we knew the anchor words of AA, then by looking at the corresponding rows of ABAB we could“read off” the corresponding row of BB (up to scaling), and use these in turn to recover all of AA. Thus the anchor words constitute the “key” that “unlocks” the factorization, and indeed the main step of our earlier NMF algorithm was a geometric procedure to identify the anchor words. When one is given a noisy version of ABAB, the analogous notion is “almost anchor” words, which correspond to rows of ABAB that are “very close” to rows of BB; see Theorem 2.7.

Now we sketch how to apply these insights to learning topic models. Let MM denote the provided term-by-document matrix, whose each column describes the empirical word frequencies in the documents. It is obtained from sampling AWAW and thus is an extremely noisy approximation to AWAW. Our algorithm starts by forming the Gram matrix MMTMM^{T}, which can be thought of as an empirical word-word covariance matrix. In fact as the number of documents increases 1mMMT\frac{1}{m}MM^{T} tends to a limit Q=1mE[AWWTA],Q=\frac{1}{m}E[AWW^{T}A], implying Q=AR(T)ATQ=AR(\mathcal{T})A^{T}. (See Lemma 3.7.) Imagine that we are given the exact matrix QQ instead of a noisy approximation. Notice that QQ is a product of three nonnegative matrices, the first of which is pp-separable and the last is the transpose of the first. NMF at first sight seems too weak to help find such factorizations. However, if we think of QQ as a product of two nonnegative matrices, AA and R(T)ATR(\mathcal{T})A^{T}, then our NMF algorithm can at least identify the anchor words of AA. As noted above, these suffice to recover R(T)ATR(\mathcal{T})A^{T}, and then (using the anchor words of AA again) all of AA as well. See Section 3.1 for details.

Of course, we are not given QQ but merely a good approximation to it. Now our NMF algorithm allows us to recover “almost anchor” words of AA, and the crux of the proof is Section 3.2 showing that these suffice to recover provably good estimates to AA and WWTWW^{T}. This uses (mostly) bounds from matrix perturbation theory, and interrelationships of condition numbers mentioned in Section 2.

For simplicity we assume the following condition on the topic model, which we will see in Section 3.5 can be assumed without loss of generality:

(*) The number of words, nn, is at most 4ar/ϵ4ar/\epsilon.

Please see Algorithm 1: Main Algorithm for description of the algorithm. Note that RR is our shorthand for 1mWWT\frac{1}{m}WW^{T}, which as noted converges to R(T)R(\mathcal{T}) as the number of documents increases.

We first describe how the recovery procedure works in an “idealized” setting (Algorthm 2,Recover with True Anchor Words), when we are given the exact value of ARATARA^{T} and a set of anchor words – one for each topic. We can permute the rows of AA so that the anchor words are exactly the first rr words. Therefore AT=(D,UT)A^{T}=(D,U^{T}) where DD is a diagonal matrix. Note that DD is not necessarily the identity matrix (nor even a scaled copy of the identity matrix), but we do know that the diagonal entries are at least pp. We apply the same permutation to the rows and columns of QQ. As shown in Figure 1, if we look at the submatrix formed by the first rr rows and rr columns, it is exactly DRDDRD. Similarly, the submatrix consisting of the first rr rows is exactly DRATDRA^{T}. We can use these two matrices to compute RR and AA, in this idealized setting (and we will use the same basic strategy in the general case, but need only be more careful about how we analyze how errors compound in our algorithm).

Our algorithm has exact knowledge of the matrices DRDDRD and DRATDRA^{T}, and so the main task is to recover the diagonal matrix DD. Given DD, we can then compute AA and RR (for the Dirichlet Allocation we can also compute its parameters - i.e. the α⃗\vec{\alpha} so that R(α)=RR(\alpha)=R). The key idea to this algorithm is that the row sums of DRDR and DRATDRA^{T} are the same, and we can use the row sums of DRDR to set up a system of linear constraints on the diagonal entries of D−1D^{-1}.

When the matrix QQ is exactly equal to ARATARA^{T} and we know the set of anchor words, Recover with True Anchor Words outputs AA and RR correctly.

Proof: The Lemma is straight forward from Figure 1 and the procedure. By Figure 1 we can find the exact value of DRATDRA^{T} and DRDDRD in the matrix QQ. Step 2 of recover computes DR1⃗DR\vec{1} by computing DRAT1⃗DRA^{T}\vec{1}. The two vectors are equal because AA is the topic-term matrix and its columns sum up to 1, in particular AT1⃗=1⃗A^{T}\vec{1}=\vec{1}.

In Step 3, since RR is invertible by Lemma 2.2, DD is a diagonal matrix with entries at least pp, the matrix DRDDRD is also invertible. Therefore there is a unique solution z⃗=(DRD)−1DR1⃗=D−11⃗\vec{z}=(DRD)^{-1}DR\vec{1}=D^{-1}\vec{1}. Also Dz⃗=1⃗D\vec{z}=\vec{1} and hence D\mboxDiag(z)=ID\mbox{Diag}(z)=I. Finally, using the fact that D\mboxDiag(z)=ID\mbox{Diag}(z)=I, the output in step 4 is just (DR)−1DRAT=AT(DR)^{-1}DRA^{T}=A^{T}, and the output in step 5 is equal to RR. ■\blacksquare

2 Recover R𝑅R and A𝐴A with Almost Anchor Words

What if we are not given the exact anchor words, but are given words that are “close” to anchor words? As we noted, in general we cannot hope to recover the true anchor words, but even a good approximation will be enough to recover RR and AA.

When we restrict AA to the rows corresponding to “almost” anchor words, the submatrix will not be diagonal. However, it will be close to a diagonal in the sense that the submatrix will be a diagonal matrix DD multiplied by EE, and EE is close to the identity matrix (and the diagonal entries of DD are at least Ω(p)\Omega(p)). Here we analyze the same procedure as above and show that it still recovers AA and RR (approximately) even when given “almost” anchor words instead of true anchor words. For clarity we state the procedure again in Algorithm 3: Recover with Almost Anchor Words. The guarantees at each step are different than before, but the implementation of the procedure is the same. Notice that here we permute the rows of AA (and hence the rows and columns of QQ) so that the “almost” anchor words returned by Theorem 2.6 appear first and the submatrix AA on these rows is equal to DEDE.

Here, we still assume that the matrix QQ is exactly equal to ARATARA^{T} and hence the first rr rows of QQ form the submatrix DERATDERA^{T} and the first rr rows and columns are DERETDDERE^{T}D. The complication here is that \mboxDiag(z)\mbox{Diag}(z) is not necessarily equal to D−1D^{-1}, since the matrix EE is not necessarily the identity. However, we can show that \mboxDiag(z)\mbox{Diag}(z) is ”close” to D−1D^{-1} if EE is suitably close to the identity matrix – i.e. given good enough proxies for the anchor words, we can bound the error of the above recovery procedure. We write E=I+ZE=I+Z. Intuitively when ZZ has only small entries EE should behave like the identity matrix. In particular, E−1E^{-1} should have only small off-diagonal entries. We make this precise through the following lemmas:

Let E=I+ZE=I+Z and ∑i,j∣Zi,j∣=ϵ<1/2\sum_{i,j}|Z_{i,j}|=\epsilon<1/2, then E−11⃗E^{-1}\vec{1} is a vector with entries in the range [1−2ϵ,1+2ϵ][1-2\epsilon,1+2\epsilon].

Proof: EE is clearly invertible because the spectral norm of ZZ is at most 1/21/2. Let b⃗=E−11⃗\vec{b}=E^{-1}\vec{1}. Since E=I+ZE=I+Z we multiply EE on both sides to get b⃗+Zb⃗=1⃗\vec{b}+Z\vec{b}=\vec{1}. Let bmaxb_{max} be the largest absolute value of any entry of bb (bmax=max⁡∣bi∣b_{max}=\max|b_{i}|). Consider the entry ii where bmaxb_{max} is achieved, we know bmax=∣bi∣≤1+∣(Zb)i∣≤1+∑j∣Zi,j∣∣bj∣≤1+ϵbmax.b_{max}=|b_{i}|\leq 1+|(Zb)_{i}|\leq 1+\sum_{j}|Z_{i,j}||b_{j}|\leq 1+\epsilon b_{max}. Thus bmax≤1/(1−ϵ)≤2b_{max}\leq 1/(1-\epsilon)\leq 2. Now all the entries in Zb⃗Z\vec{b} are within 2ϵ2\epsilon in absolute value, and we know that b⃗=1⃗+Zb⃗\vec{b}=\vec{1}+Z\vec{b}. Hence all the entries of bb are in the range [1−2ϵ,1+2ϵ][1-2\epsilon,1+2\epsilon], as desired. ■\blacksquare

Proof: Without loss of generality, we can consider just the first column of E−1−IE^{-1}-I, which is equal to (E−1−I)e1⃗(E^{-1}-I)\vec{e_{1}}, where e1⃗\vec{e_{1}} is the indicator vector that is one on the first coordinate and zero elsewhere.

The approach is similar to that in Lemma 3.2. Let b⃗=(E−1−I)e1⃗\vec{b}=(E^{-1}-I)\vec{e_{1}}. Left multiply by E=(I+Z)E=(I+Z) and we obtain b⃗+Zb⃗=−Ze1⃗\vec{b}+Z\vec{b}=-Z\vec{e_{1}}. Hence b⃗=−Z(b⃗+e1⃗)\vec{b}=-Z(\vec{b}+\vec{e_{1}}). Let bmaxb_{max} be the largest absolute value of entries of b⃗\vec{b} (bmax=max⁡∣bi∣b_{max}=\max|b_{i}|). Let ii be the entry in which bmaxb_{max} is achieved. Then

Therefore bmax≤ϵ/(1−ϵ)≤2ϵb_{max}\leq\epsilon/(1-\epsilon)\leq 2\epsilon. Further, the ∥b⃗∥1≤∥Ze1⃗∥1+∥Zb⃗∥1≤ϵ+2ϵ2≤2ϵ\|\vec{b}\|_{1}\leq\|Z\vec{e_{1}}\|_{1}+\|Z\vec{b}\|_{1}\leq\epsilon+2\epsilon^{2}\leq 2\epsilon. ■\blacksquare

Now we are ready to show that the procedure Recover with Almost Anchor Words succeeds when given ”almost” anchor words:

Proof: Since QQ is exactly ARATARA^{T}, our algorithm is given DERATDERA^{T} and DERETDDERE^{T}D with no error. In Step 3, since DD, EE and RR are all invertible, we have

Ideally we would want \mboxDiag(z)=D−1\mbox{Diag}(z)=D^{-1}, and indeed D\mboxDiag(z)=\mboxDiag((ET)−11⃗)D\mbox{Diag}(z)=\mbox{Diag}((E^{T})^{-1}\vec{1}). From Lemma 3.2, the vector (ET)−11⃗(E^{T})^{-1}\vec{1} has entries in the range [1−2ϵ,1+2ϵ][1-2\epsilon,1+2\epsilon], thus each entry of \mboxDiag(z)\mbox{Diag}(z) is within a (1±2ϵ)(1\pm 2\epsilon) multiplicative factor from the corresponding entry in D−1D^{-1}.

Consider the output in Step 4. Since DD, EE, RR are invertible, the first output is

For each jj, ∥ej⃗T(D\mboxDiag(z))−1(ET)−1−ej⃗T∥1≤5ϵ\|\vec{e_{j}}^{T}(D\mbox{Diag}(z))^{-1}(E^{T})^{-1}-\vec{e_{j}}^{T}\|_{1}\leq 5\epsilon

The last term can be bounded by 2ϵ2\epsilon. Consider the first term on the right hand side: The vector e1⃗T(D\mboxDiag(z))−1−e1⃗T\vec{e_{1}}^{T}(D\mbox{Diag}(z))^{-1}-\vec{e_{1}}^{T} has one non-zero entry (the first one) whose absolute value is at most 3ϵ3\epsilon. Hence, from Lemma 3.3 the first term can be bounded by 6ϵ2≤3ϵ6\epsilon^{2}\leq 3\epsilon, and this implies the claim. ■\blacksquare

The main idea of the proof is to write DERETD+VDERE^{T}D+V as DER(ET+V′)DDER(E^{T}+V^{\prime})D. In this way the error VV can be translated to an error V′V^{\prime} on EE and Lemma 3.4 can be applied. The error UU can be handled similarly.

Hence DERETD+V=DER(ET+V′)DDERE^{T}D+V=DER(E^{T}+V^{\prime})D and the additive error for DERETDDERE^{T}D can be transformed into error in EE, and we will be able to apply the analysis in Lemma 3.4.

Similarly, we can express the error term UU as U=DERU′U=DERU^{\prime}. Entries of U′U^{\prime} have absolute value at most 8ϵ1r/γp28\epsilon_{1}r/\gamma p^{2}. The right hand side of the equation in step 3 is equal to DER1⃗+U1⃗DER\vec{1}+U\vec{1} so the error is at most ϵ1\epsilon_{1} per entry. Following the proof of Lemma 3.4, we know \mboxDiag(z)D\mbox{Diag}(z)D has diagonal entries within 1±(2ϵ+16ϵ2/γp3+2ϵ1)1\pm\left(2\epsilon+16\epsilon_{2}/\gamma p^{3}+2\epsilon_{1}\right).

Now we consider the output. The output for ATA^{T} is equal to

Similarly, the output of RR is equal to \mboxDiag(z)(DERETD+V)\mboxDiag(z)\mbox{Diag}(z)(DERE^{T}D+V)\mbox{Diag}(z). Again we write \mboxDiag(z)D=I+Z1\mbox{Diag}(z)D=I+Z_{1} and E=I+Z2E=I+Z_{2}. The extra term \mboxDiag(z)V\mboxDiag(z)\mbox{Diag}(z)V\mbox{Diag}(z) is small because the entries of zz are at most to 2/p2/p (otherwise \mboxDiag(z)D\mbox{Diag}(z)D won’t be close to identity). The error can be bounded by O(ϵ+(raϵ2/p3+ϵ1r/p2)/γ)O(\epsilon+(ra\epsilon_{2}/p^{3}+\epsilon_{1}r/p^{2})/\gamma). ■\blacksquare

Now in order to prove our main theorem we just need to show that when number of documents is large enough, the matrix QQ is close to the ARATARA^{T}, and plug the error bounds into Lemma 3.6.

3 Error Bounds for Q𝑄Q

Here we show that the matrix QQ indeed converges to 1mAWWTAT=ARAT\frac{1}{m}AWW^{T}A^{T}=ARA^{T} when mm is large enough.

Proof: We shall first show that the expectation of QQ is equal to ARATARA^{T} where RR is 1mWWT\frac{1}{m}WW^{T}. Then by concentration bounds we show that entries of QQ are close to their expectations. Notice that we can also hope to show that QQ converges to AR(T)ATAR(\mathcal{T})A^{T}. However in that case we will not be able to get the inverse polynomial relationship with NN (indeed, even if NN goes to infinity it is impossible to learn R(T)R(\mathcal{T}) with only one document). Replacing R(T)R(\mathcal{T}) with the empirical RR allows our algorithm to perform better when the number of words per document is larger.

4 Proving the Main Theorem

When ϵQ<ϵp3γ/a2r3\epsilon_{Q}<\epsilon p^{3}\gamma/a^{2}r^{3} the error is bounded by ϵ\epsilon . In this case we need

The latter constraint comes from Lemma 2.2.

To get within ϵ\epsilon additive error for the parameter α\alpha, we further need RR to be close enough to the variance-covariance matrix of the document-topic distribution, which means mm is at least

5 Reducing Dictionary Size

Above we assumed that the number of distinct words is small. Here, we give a simple gadget that shows in the general case we can assume that this is the case at the loss of an additional additive ϵ\epsilon in our accuracy:

The general case can be reduced to an instance in which there are at most 4ar/ϵ4ar/\epsilon words all of which (with at most one exception) occur with probability at least ϵ/4ar\epsilon/4ar.

Proof: In fact, we can collect all words that occur infrequently and “merge” all of these words into a aggregate word that we will call the runoff word. To this end, we call a word large if it appears more than ϵmN/3ar\epsilon mN/3ar times in m=100arlog⁡nNϵm=\frac{100ar\log n}{N\epsilon} documents, and otherwise we call it small. Indeed, with high probability all large words are words that occur with probability at least ϵ/4ar\epsilon/4ar in our model. Also, all words that has a entry larger than ϵ\epsilon in the corresponding row of AA will appear with at least ϵ/ar\epsilon/ar probability, and is thus a large word with high probability. We can merge all small words (i.e. rename all of these words to a single, new word). Hence we can apply the above algorithm (which assumed that there are not too many distinct words). After we get a result with the modified documents we can ignore the runoff words and assign weight for all the small words. The result will still be correct up to ϵ\epsilon additive error. ■\blacksquare

The Dirichlet Subcase

Here we demonstrate that the parameters of a Dirichlet distribution can be (robustly) recovered from just the covariance matrix R(T)R(\mathcal{T}). Hence an immediate corollary is that our main learning algorithm can recover both the topic matrix AA and the distribution that generates columns of WW in a Latent Dirichlet Allocation (LDA) Model , provided that AA is separable. We believe that this algorithm may be of practical use, and provides the first alternative to local search and (unproven) approximation procedures for this inference problem , , .

where Γ\Gamma is the Gamma function. In particular, when all the αi\alpha_{i}’s are equal to one, the Dirichlet Distribution is just the uniform random distribution over the probability simplex.

The expectation and variance of θi\theta_{i}’s are easy to compute given the parameters α\alpha. We denote α0=∥α∥1=∑i=1rαi\alpha_{0}=\left\lVert\alpha\right\rVert_{1}=\sum_{i=1}^{r}\alpha_{i}, then the ratio αi/α0\alpha_{i}/\alpha_{0} should be interpreted as the “size” of the ii-th variable θi\theta_{i}, and α0\alpha_{0} shows whether the distributions is concentrated in the interior (when α0\alpha_{0} is large) or near the boundary (when α0\alpha_{0} is small). The first two moments of Dirichlet Distribution is listed as below:

Suppose the Dirichlet distribution has max⁡αi/min⁡αi=a\max\alpha_{i}/\min\alpha_{i}=a and the sum of parameters is α0\alpha_{0}; we give an algorithm that computes close estimates to the vector of parameters α\alpha given a sufficiently close estimate to the co-variance matrix R(T)R(\mathcal{T}) (Theorem 4.3). Combining this with Theorem 1.4, we obtain the following corollary:

There is an algorithm that learns the topic matrix AA with high probability up to an additive error of ϵ\epsilon from at most

documents sampled from the LDA model and runs in time polynomial in nn, mm. Furthermore, we also recover the parameters of the Dirichlet distribution to within an additive ϵ\epsilon.

There is a well-known meta-principle that if a matrix WW is chosen by picking its columns independently from a fairly diffuse distribution, then it will be far from low rank. However, our analysis will require us to prove an explicit lower bound on Γ(R(T))\Gamma(R(\mathcal{T})). We now prove such a bound when the columns of WW are chosen from a Dirichlet distribution with parameter vector α\alpha. We note that it is easy to establish such bounds for other types of distributions as well. Recall that we defined R(T)R(\mathcal{T}) in Section 1, and here we will abuse notation and throughout this section we will denote by R(α)R(\alpha) the matrix R(T)R(\mathcal{T}) where T\mathcal{T} is a Dirichlet distribution with parameter α\alpha.

Let α0=∑i=1rαi\alpha_{0}=\sum_{i=1}^{r}\alpha_{i}. The mean, variance and co-variance for a Dirichlet distribution are well-known, from which we observe that R(α)i,jR(\alpha)_{i,j} is equal to αiαjα0(α0+1)\frac{\alpha_{i}\alpha_{j}}{\alpha_{0}(\alpha_{0}+1)} when i≠ji\neq j and is equal to αi(αi+1)α0(α0+1)\frac{\alpha_{i}(\alpha_{i}+1)}{\alpha_{0}(\alpha_{0}+1)} when i=ji=j.

Proof: As the entries R(α)i,jR(\alpha)_{i,j} is αiαjα0(α0+1)\frac{\alpha_{i}\alpha_{j}}{\alpha_{0}(\alpha_{0}+1)} when i≠ji\neq j and αi(αi+1)α0(α0+1)\frac{\alpha_{i}(\alpha_{i}+1)}{\alpha_{0}(\alpha_{0}+1)} when i=ji=j, after normalization R(α)R(\alpha) is just the matrix D′=1α0+1(α×(1,1,...,1)+I)D^{\prime}=\frac{1}{\alpha_{0}+1}\left(\alpha\times(1,1,...,1)+I\right) where ×\times is outer product and II is the identity matrix.

Let xx be a vector such that ∣x∣1=1|x|_{1}=1 and ∣D′x∣1|D^{\prime}x|_{1} achieves the minimum in Γ(R(α))\Gamma(R(\alpha)) and let I={i∣xi≥0}I=\{i|x_{i}\geq 0\} and let J=IˉJ=\bar{I} be the complement. We can assume without loss of generality that ∑i∈Ixi≥∣∑i∈Jxi∣\sum_{i\in I}x_{i}\geq|\sum_{i\in J}x_{i}| (otherwise just take −x-x instead). The product D′xD^{\prime}x is ∑xiα0+1α+1α0+1x\frac{\sum x_{i}}{\alpha_{0}+1}\alpha+\frac{1}{\alpha_{0}+1}x. The first term is a nonnegative vector and hence for each i∈Ii\in I, (D′x)i≥0(D^{\prime}x)^{i}\geq 0. This implies that

2 Recovering the Parameters of a Dirichlet Distribution

Proof: The αi/α0\alpha_{i}/\alpha_{0}’s all have error at most ϵR\epsilon_{R}. The value uu is αiα0αi+1α0+1±ϵR\frac{\alpha_{i}}{\alpha_{0}}\frac{\alpha_{i}+1}{\alpha_{0}+1}\pm\epsilon_{R} and the value vv is αi/α0±ϵR\alpha_{i}/\alpha_{0}\pm\epsilon_{R}. Since v≥1/arv\geq 1/ar we know the error for u/vu/v is at most 2arϵR2ar\epsilon_{R}. Finally we need to bound the denominator αi+1α0+1−αiα0>12(α0+1)\frac{\alpha_{i}+1}{\alpha_{0}+1}-\frac{\alpha_{i}}{\alpha_{0}}>\frac{1}{2(\alpha_{0}+1)} (since αiα0≤1/r≤1/2\frac{\alpha_{i}}{\alpha_{0}}\leq 1/r\leq 1/2). Thus the final error is at most 5ar(α0+1)ϵR5ar(\alpha_{0}+1)\epsilon_{R}. ■\blacksquare

Obtaining Almost Anchor Words

In this section, we prove Theorem 2.7, which we restate here:

A point M′jM^{\prime j} is (δ,ϵ)(\delta,\epsilon)-close to M′iM^{\prime i} if and only if

We also consider all points that a row M′jM^{\prime j} is close to, this is called the neighborhood of M′jM^{\prime j}.

The (δ,ϵ)(\delta,\epsilon)-neighborhood of M′jM^{\prime j} are the rows M′iM^{\prime i} such that M′jM^{\prime j} is (δ,ϵ)(\delta,\epsilon)-close to M′iM^{\prime i}.

For each point M′jM^{\prime j}, we know its original (unperturbed) point MjM_{j} is in a convex combination of WiW^{i}’s: Mj=∑i=1rAj,iWiM^{j}=\sum_{i=1}^{r}A_{j,i}W^{i}. Separability implies that for any column index ii there is a row f(i)f(i) in AA whose only nonzero entry is in the ithi^{th} column. Then Mf(i)=WiM^{f(i)}=W^{i} and consequently ∥M′f(i)−Wi∥1<ϵ\|M^{\prime f(i)}-W^{i}\|_{1}<\epsilon. Let us call these rows M′f(i)M^{\prime f(i)} for all ii the canonical rows. From the above description the following claim is clear.

and we can bound the right hand side by 2ϵ2\epsilon. ■\blacksquare

Our goal is to show that a row is a robust loner if and only if it is close to some row in WW. The following lemma establishes one direction:

If Aj,tA_{j,t} is smaller than 1−10ϵ/γ1-10\epsilon/\gamma, the point M′jM^{\prime j} cannot be (6ϵ/γ,2ϵ)(6\epsilon/\gamma,2\epsilon)-close to the canonical row that corresponds to WtW^{t}.

If Aj,tA_{j,t} is smaller than 1−10ϵ/γ1-10\epsilon/\gamma for all tt, the row M′jM^{\prime j} cannot be a robust loner.

Proof: By the above lemma, we know the canonical rows are not in the (6ϵ/γ,2ϵ)(6\epsilon/\gamma,2\epsilon) neighborhood of M′jM^{\prime j}. Thus by Claim 5.4 the row is close to the convex hull of canonical rows and cannot be a robust loner. ■\blacksquare

Next we prove the other direction: a canonical row is necessarily a robust loner:

Proof: Suppose M′iM^{\prime i} is a canonical row that corresponds to WtW^{t}. We first observe that all the rows that are outside the (6ϵ/γ,2ϵ)(6\epsilon/\gamma,2\epsilon) neighborhood of M′jM^{\prime j} must have Aj,t<1−6ϵ/γA_{j,t}<1-6\epsilon/\gamma. This is because when Aj,t≥1−6ϵ/γA_{j,t}\geq 1-6\epsilon/\gamma we have Mj−∑k=1rAj,tWt=0⃗M^{j}-\sum_{k=1}^{r}A_{j,t}W^{t}=\vec{0}. If we replace MjM^{j} by M′jM^{\prime j} and WtW^{t} by the corresponding canonical row, the distance is still at most 2ϵ2\epsilon and the coefficient on M′iM^{\prime i} is at least 1−6ϵ/γ1-6\epsilon/\gamma. By definition the corresponding row M′jM^{\prime j} must be in the neighborhood of M′iM^{\prime i}.

Now we can prove the main theorem of this section:

Proof: Suppose we know γ\gamma and 100ϵ<γ100\epsilon<\gamma.When γ\gamma is so small we have the following claim:

If Aj,tA_{j,t} and Ai,lA_{i,l} is at least 1−10ϵ/γ1-10\epsilon/\gamma, and t≠lt\neq l, then M′jM^{\prime j} cannot be (10ϵ/γ,2ϵ)(10\epsilon/\gamma,2\epsilon)-close to M′iM^{\prime i} and vice versa.

The proof is almost identical to Lemma 5.6. Also, the canonical row that corresponds to WtW^{t} is (10ϵ/γ,2ϵ)(10\epsilon/\gamma,2\epsilon) close to all rows with Aj,t≥1−10ϵ/γA_{j,t}\geq 1-10\epsilon/\gamma. Thus if we connect two robust loners when one is (10ϵ/γ,2ϵ)(10\epsilon/\gamma,2\epsilon) close to the other, the connected component of the graph will exactly be a partition according to the row in WW that the robust loner is close to. We pick one robust loner in each connected component to get the almost anchor words.

Now suppose we don’t know γ\gamma. In this case the problem is we don’t know what is the right size of neighborhood to look at. However, since we know γ>100ϵ\gamma>100\epsilon, we shall first run the algorithm with γ=100ϵ\gamma=100\epsilon to get rr rows W′W^{\prime} that are very close to the true rows in WW. It is not hard to show that these rows are at least γ/2\gamma/2 robustly simplicial and at most γ+2ϵ\gamma+2\epsilon robustly simplicial. Therefore we can compute the γ(W′)\gamma(W^{\prime}) parameter for this set of rows and use γ(W′)−2ϵ\gamma(W^{\prime})-2\epsilon as the γ\gamma parameter. ■\blacksquare

Maximum Likelihood Estimation is Hard

Here we prove that computing the Maximum Likelihood Estimate (MLE) of the parameters of a topic model is NPNP-hard. We call this problem the Topic Model Maximum Likelihoood Estimation (TM-MLE) problem:

Given mm documents and a target of rr topics, the TM-MLE problem asks to compute the topic matrix AA that has the largest probability of generating the observed documents (when the columns of WW are generated by a uniform Dirichlet distribution).

Surprisingly, this appears to be the first proof that computing the MLE estimate in a topic model is indeed computationally hard, although its hardness is certainly to be expected. On a related note, Sontag and Roy recently proved that given the topic matrix and a document, computing the Maximum A Posteriori (MAP) estimate for the distribution on topics that generated this document is NPNP-hard. Here we will establish that TM-MLE is NPNP-hard via a reduction from the MIN-BISECTION problem: In MIN-BISECTION the input is a graph with nn vertices (nn is an even integer), and the goal is to partition the vertices into two equal sized sets of n/2n/2 vertices each so as to minimize the number of edges crossing the cut.

There is a polynomial time reduction from MIN-BISECTION to TM-MLE (r=2r=2).

Proof: Suppose we are given an instance GG of the MIN-BISECTION problem with nn vertices and mm edges. We will now define an instance of the TM-MLE problem. First, we set the number of words to be nn. For each word ii, we construct N=⌈200m3log⁡n⌉N=\lceil 200m^{3}\log n\rceil documents each of which contain the word ii twice and no other words. For each edge in the graph GG, we construct a document whose two words correspond to the endpoints of the edge.

Suppose that x=(x1,x2)Tx=(x_{1},x_{2})^{T} is generated by the Dirichlet distribution Dir(1,1)Dir(1,1). Consequently the probability that words ii and jj appear in a document with only two words is exactly (Aix)⋅(Ajx)(A^{i}x)\cdot(A^{j}x). We can take the expectation of this term over the Dirichlet distribution Dir(1,1)Dir(1,1) and hence the probability that a document (with exactly two words) contains the words ii and jj is

In the TM-MLE problem, our goal is to maximize the following objective function (which is the log⁡\log of the probability of generating the collection of documents):

For any bisection, we define a canonical solution: the first topic is uniform on all words on one side of the bisection and the second topic is uniform on all words on the other side of the bisection.To prove the correctness of our reduction, a key step is to show that any candidate solution to the MLE problem must be close to a canonical solution. In particular, we show the following:

In each row AiA^{i}, almost all of the weight will be in one of the two topics.

Indeed, canonical solutions have large objective value. Any canonical solution has objective value at least −Nnlog⁡3n2/4−mlog⁡3n2/2-Nn\log 3n^{2}/4-m\log 3n^{2}/2 (this is because documents with same words contribute −log⁡3n2/4-\log 3n^{2}/4 and documents with different words contribute at least −log⁡3n2/2-\log 3n^{2}/2).

Now we claim that among canonical solutions, the one with largest objective value corresponds to a minimum bisection. The proof follows from the observation that the value of the objective function is −Nnlog⁡3n2/4−klog⁡3n2/2−(m−k)log⁡3n2/4-Nn\log 3n^{2}/4-k\log 3n^{2}/2-(m-k)\log 3n^{2}/4 for canonical solutions, where kk is the number of edges cut by the bisection. In particular, the objective function of the minimum bisection will be at least an additive log⁡2\log 2 larger than the objective function of a non-minimum bisection.

However, even if the canonical solution is perturbed by 1/20nm1/20nm, the objective function will only change by at most m⋅1/10m=1/10m\cdot 1/10m=1/10, which is much smaller than log⁡22\frac{\log 2}{2}. And this completes our reduction. ■\blacksquare

We remark that the canonical solutions in our reduction are all separable, and hence this reduction applies even when the topic matrix AA is known (and required) to be separable. So, even in the case of a separable topic matrix, it is NPNP-hard to compute the MLE.

Conclusions

We expect that versions of our algorithm may indeed be practical, and are investigating this possibility. Our machine learning colleagues suggest that real-life topic matrices satisfy even stronger separability assumptions, e.g., the presence of many anchor words per topic instead of a single one. This is a promising suggestion, but leveraging it in our algorithm is an open problem.

Is separability necessary for allowing polynomial-time algorithms for the learning problems considered here? In other words, is the problem difficult if the topic matrix AA is not separable? Average-case intractability seems more plausible here than NP-completeness.

Acknowledgements

We thank Dave Blei, Ravi Kannan, David Minmo, Sham Kakade, David Sontag for many helpful discussions throughout various stages of this work.

References