Fast and robust tensor decomposition with applications to dictionary learning
Tselil Schramm, David Steurer
Introduction
Tensor decomposition is studied extensively across many disciplines including machine learning and signal processing. It is a powerful primitive for solving a wide range of other inverse / learning problems, for example: blind source separation / independent component analysis [LCC07], learning phylogenetic trees and hidden Markov models [MR05], mixtures of Gaussians [HK13], topic models [AFH+12], dictionary learning [BKS15, MSS16], and noisy-or Bayes nets [AGMR16].
A classical algorithm based on simultaneous diagonalization [Har70, LMV96] (often attributed to R. Jennrich) can decompose the input tensor (1.1) when the components are linearly independent, there is no error, and the order of the tensor is at least . Current research on algorithms for tensor decomposition aims to improve over the guarantees of this classical algorithm in two important ways:
What conditions allow us to decompose tensors when components are linearly dependent?
What kind of errors can efficient decomposition algorithms tolerate? Can we tolerate errors with “magnitude” comparable to the low-rank part ?
The focus of this work is on robustness. There are two ways in which errors arise in applications of tensor decomposition. The first is due to finite samples. For example, in some applications is the empirical -th moment of some distribution and the error accounts for the difference between the empirical moment and actual moment (“population moment”). Errors of this kind can be made smaller at the expense of requiring a larger number of samples from the distribution. Therefore, robustness of decomposition algorithms helps with reducing sample complexity.
Another way in which errors arise is from modeling errors (“systematic errors”). These kinds of errors are more severe because they cannot be reduced by taking larger samples. Two important applications of tensor decomposition with such errors are learning Noisy-or Bayes networks [AGMR16] and sparsely-used dictionaries [BKS15]. For noisy-or networks, the errors arise due to non-linearities in the model. For sparsely-used dictionaries, the errors arise due to unknown correlations in the distribution of sparse feature representations. These examples show that robust tensor decomposition allows us to capture a wider range of models.
Robustness guarantees for tensor decomposition algorithms have been studied extensively (e.g., the work on tensor power iteration [AGH+14]). The polynomial-time algorithm with the best known robustness guarantees for tensor decomposition [BKS15, MSS16] are based on the sum-of-squares (SOS) method, a powerful meta-algorithm for polynomial optimization problems based on semidefinite programming relaxations. Unfortunately, these algorithms are far from practical and have polynomial running times with large exponents. The goal of this work is to develop practical tensor decomposition algorithms with robustness guarantees close to those of SOS-based algorithms.
In this work, we develop an easy-to-implement, randomized spectral algorithm to decompose 4-tensors with orthonormal components even when the error tensor has small but constant spectral norm as a -by- matrix. This robustness guarantee is qualitatively optimal with respect to this norm in the sense that an error tensor with constant spectral norm (as a -by- matrix) could change each component by a constant proportion of its norm. To the best of our knowledge, the only previous algorithms with this kind of robustness guarantee are based on SOS.We remark that the aforementioned analysis [MSS16] of Jennrich’s algorithm can tolerate errors if its spectral norm as a non-square -by- matrix is constant. However, this norm of can be larger by a factor than its spectral norm as a square matrix. Our algorithm runs in time using fast matrix multiplication. Even without fast matrix multiplication, our running time of is close to linear in the size of the input and significantly faster than the running time of SOS. As we will discuss later, an extension of this algorithm allows us to solve instances of dictionary learning that previously could provably be solved only by SOS.
A related previous work [HSSS16] also studied the question how to achieve similar guarantees for tensor decomposition as SOS using just spectral algorithms. Our algorithms follow the same general strategy as the algorithms in this prior work: In an algorithm based on the SOS semidefinite program, one solves a convex programming relaxation to obtain a “proxy” for a true, integral solution (such as a component of the tensor). Because the program is a relaxation, one must then process or “round” the relaxation or proxy into a true solution. In our algorithms, as in [HSSS16], instead of finding solutions to SOS semidefinite programs, the algorithms find “proxy objects” that behave in similar ways with respect to the rounding procedures used by SOS-based algorithms. Since these rounding procedures tend to be quite simple, there is hope that generating proxy objects that “fool” these procedures is computationally more efficient than solving general semidefinite programs.
However, our algorithmic techniques for finding these “proxy objects” differ significantly from those in prior work. The reason is that many of the techniques in [HSSS16], e.g., concentration inequalities for matrix-valued polynomials, are tailored to average-case problems and therefore do not apply in our setting because we do not make distributional assumption about the errors .
Dictionary learning, also known as sparse coding, is studied extensively in neuroscience [OF97], machine learning [EP07, MRBL07], and computer vision [EA06, MLB+08, YWHM08]. Most algorithms for this problem used in practice do not come with strong provable guarantees. In recent years, several algorithms with provable guarantees have been developed for this problem [AAJ+14, ABGM14, AGMM15, BKS15, MSS16, HM16].
For the case that the coordinates of the distribution are independent (and non-Gaussian) there is a well-known reductionThe reduction only requires -wise independence where is the order to tensor the reduction produces. of this problem to tensor decomposition where the components are the columns of and the error can be made inverse polynomially small by taking sufficiently many samples. (In the case of independent coordinates, dictionary learning becomes a special case of independent component analysis / blind source separation, where this reduction originated.) Variants of Jennrich’s spectral tensor decomposition algorithm (e.g., [BCMV14, MSS16]) imply strong provable guarantees for dictionary learning in the case that has independent coordinates even in the “overcomplete” regime when (using a polynomial number of samples).
More challenging is the case that has non-independent coordinates, especially if those correlations are unknown. We consider a model proposed in [BKS15] (similar to a model in [ABGM14]): We say that the distribution is -nice if
An extension of our aforementioned algorithm for orthogonal tensor decomposition with spectral norm error allows us to learn orthonormal dictionaries from -nice distributions. To the best of our knowledge, the only previous algorithms to provably solve this problem use sum-of-squares relaxations [BKS15, MSS16], which have large polynomial running time. Our algorithm recovers a fraction of the columns of up to error from samples, and runs in time . By a standard reduction, our algorithm also works for non-singular dictionaries and the running time increases by a factor polynomial in the condition number of .
1 Results
For tensor decomposition, we give an algorithm with close to linear running time that recovers the rank-1 components of a tensor with orthonormal components, so long as the spectral norm of the square unfoldings of the error tensor is small.
Furthermore, if , the algorithm can recover all components up to error in time with high probability. Here, is the matrix multiplication exponent.
The orthogonality condition may at first seem restrictive, but for most applications it is possible to take a tensor with linearly independent components and transform it to a tensor with orthogonal components, as we will do for our dictionary learning result below. Furthermore, our algorithm works as-is if the components are sufficiently close to orthonormal:
These robustness guarantees are comparable to those of the sum-of-squares-based algorithms in [BKS15, MSS16] for the undercomplete case, which are the best known. Meanwhile, the sum-of-squares based algorithms require solving large semidefinite programs, while the running time of our algorithms is close to linear in the size of the input, and our algorithms are composed of simple matrix-vector multiplications.
On the other hand, our algorithms fail to work in the overcomplete case, when the rank grows above , and the components are no longer linearly independent. One interesting open question is whether the techniques used in this paper can be extended to the overcomplete case.
Dictionary learning
Using our tensor decomposition algorithm as a primitive, we give an algorithm for dictionary learning when the sample distribution is -nice.
The total runtime is thus —in the theorem statement, we write it in terms of the number of samples in order to separate the time spent processing the samples from the learning phase. We note that the sample complexity bound that we have, , may very well be sub-optimal; we suspect that is closer to the truth, which would yield a better runtime.
We are also able to apply standard whitening operations (as in e.g. [AGHK13]) to extend our algorithm to dictionaries with linearly-independent, but non-orthonormal, columns, at the cost of polynomially many additional samples.
To our knowledge, our algorithms are the only remotely efficient dictionary learning algorithms with provable guarantees that permit -nice distributions in which the coordinates of may be correlated by constant factors, the only other ones being the sum-of-squares semidefinite programming based algorithms of [BKS15, MSS16].
Preliminaries
We will also make frequent use of the following lemma, which states that the distance between two points cannot increase when both are projected onto a closed, convex set.
This lemma is well-known (see e.g. [Roc76]), but we will prove it for completeness in Appendix A.
Techniques
In this section we give a high-level overview of the algorithms in our paper, and of their analyses. We begin with the tensor decomposition algorithm, after which we’ll explain the (non-trivial) extension to the dictionary learning application. At the very end, we will discuss the relationship between our algorithms and sum-of-squares relaxations.
where is the th matrix slice of the tensor . Since the are orthogonal, the coefficients are independent, and so we find ourselves in an ideal situation— is a sum of the orthogonal components we want to recover with independent Gaussian coefficients. A simple eigendecomposition will recover all of the .
On the other hand, when we have a nonzero noise tensor , a random contraction along modes results in the matrix
where the are slices of the tensor . The last term, composed of the error, complicates things. Standard facts about Gaussian matrix series assert that the spectral norm of the error term behaves like , the spectral norm of a reshaping of , whereas we only have control over square reshapings such as .In fact, this observation was crucial in the analysis of [MSS16]—in that work, semidefinite programming constraints are used to control the spectral norm of the rectangular reshapings. These can be off by polynomial factors. If the Frobenius norm of is , which is the magnitude one would expect from a tensor whose square reshapings are full-rank matrices with spectral norm , then we have that necessarily
since there are at most nonzero singular values of rectangular reshapings of . In this case, unless , the components are completely drowned out by the contribution of the noise, and so the robustness guarantees leave something to be desired.
Basic idea
The above suggests that, as long as we allow the error to have large Frobenius norm, an approach based on random contraction will not succeed. Our basic idea is to take , whose error has small spectral norm, and transform it into a tensor whose error has small Frobenius norm.
Because we do not know the decomposition of , we cannot access the error directly. However, we do know that for any reshaping of ,
where , and . The rank of is , and all eigenvalues of are . Thus, if we perform the operation
where denotes projection to the cone of positive semidefinite matrices, we expect that the signal term will survive, while the noise term will be dampened. More formally, we know that has eigenvalues of magnitude , and eigenvalues of magnitude at most , and therefore . Also by definition, . Therefore, we have that
with , and thus
Since are both of rank at most , and have spectral norm bounded by , we have that
Finally, to eliminate these large singular values, we will project into the set of matrices whose rectangular reshapings have singular values at most —because is a member of this convex set, the projection can only decrease the Frobenius norm. After this, we will apply the random contraction algorithm, as originally suggested.
Variance of Gaussian matrix series
Recall that we wanted to sample a random -dimensional Gaussian vector , and the perform the contraction
The error term on the right is a matrix Gaussian series. The following lemma describes the behavior of the spectra of matrix Gaussian series:
It turns out that for us it suffices to perform two projections in sequence—we first reshape to the matrix ,project it to the set of matrices with singular values at most , and then reshape the result along modes , and project to the same set again. As mentioned before, because projection to a convex set containing cannot increase the distance from , the Frobenius norm of the new error can only decrease. What is less obvious is that performing the second projection will not destroy the property that the reshaping along modes has spectral norm at most . By showing that each projection corresponds to either left- or right- multiplication of and by matrices of spectral norm at most , we are able to show that the second projection does not create large singular values for the first flattening, and so two projections are indeed enough. Call the resulting tensor .
Now, if we perform a random contraction in the modes , we will have
where the spectral norm of with good probability. So, ignoring for the moment dependencies between and , with probability at least , which will give correlation with the top eigenvector of with good probability.
Improving accuracy of components
The algorithm described thus far will recover components that are -correlated with the , in the sense that . To boost the accuracy of the recovered components, we use a simple method which resembles a single step of tensor power iteration.
We’ll use the closeness of our original tensor to in spectral norm. We let be a flattening of , and compute the vector
Now, when the vector is reshaped to a matrix , the term is a matrix of Frobenius norm (and thus spectral norm) at most . By the orthonormality of the , the sum of the coefficients in the second term is at most 0.1, and so is -close to the top eigenvector of .
Recovering every component
Because the Frobenius norm of the error in is , there may be a small fraction of the components that are “canceled out” by the error—for instance, we can imagine that the error term is . So while only a constant fraction of the components can be more than -correlated with the error, we may still be unable to recover some fixed -fraction of the via random contractions.
To recover all components, we must subtract the components that we have found already and run the algorithm iteratively—if we have found components, then if we could perfectly subtract them from , we would end up with an even lower-rank signal tensor, and thus be able to make progress by truncating all but eigenvalues in the first step.
The challenge is that we have recovered that are only -correlated with the , and so naively subtracting can result in a Frobenius and spectral norm error of magnitude —thus the total error is still proportional to rather than .
Dictionary learning
We can use our tensor decomposition algorithm to learn the dictionary , as long as the columns of are linearly independent. For the sake of this overview, assume instead that the columns of are orthonormal. Then given samples for , we can compute the th moment tensor to accuracy in the spectral norm,
In the sum-of-squares relaxation, this issue is overcome easily: because of the symmetries required of the SDP solution matrix , , so by linearity this low-rank error term cannot influence the objective function any more than the term.
This removes the spectrum in the direction of the “nice” error terms, corresponding to and . The fact that the rest of the matrix is low-rank means that we can apply an analysis similar to the analysis in the first step of our tensor decomposition to argue that .
Now, we re-shape , so that if initially we had the flattening , we look at the flattening . In this flattening, the term from is transformed to , and so the problematic error term from the original flattening has spectral norm in this flattening! Applying the projection
eliminates the problematic term, and brings us again closer to the target matrix . Thus, we end up with a tensor that is close to in Frobenius norm, and we can apply our tensor decomposition algorithm.
Connection to sum-of-squares algorithms
We take a moment to draw parallels between our algorithm and tensor decomposition algorithms in the sum-of-squares hierarchy. In noisy orthogonal tensor decomposition, we want to solve the non-convex program
The (somewhat simplified) corresponding sum-of-squares relaxation is the semidefinite program
To solve this semidefinite program, one should project into the intersection of all of the convex feasible regions of the constraints. However, projecting to the intersection is an expensive operation in terms of runtime. Instead, we choose a subset of these constraints, and project into the set of points satisfying each constraint sequentially, rather than simultaneously. These are not equivalent projection operations, but because we select our operations carefully, we are able to show that our is close to the SDP optimum in a sense that is sufficient for successfully running Jennrich’s algorithm.
Decomposing orthogonal 444-tensors
Truncate to 0 all eigenvalues of that have magnitude less than :
where we have used to denote projection to the PSD cone.
To compute , we can compute the top eigenvectors of . Since , where are the th and st eigenvalues, we can compute this in time via subspace power iteration (see for example [HP14]). ∎
Project to the set of tensors whose rectangular reshapings along modes have spectral norm at most (obtaining a new tensor with ).
Project to the set of tensors whose rectangular reshapings along modes have spectral norm at most , obtaining a new tensor .
Output: and , the top left- and right- unit singular vectors of .
Under the appropriate conditions on , with probability , Algorithm 4.3 will output a vector that is -correlated with for some .
Recovering one component requires time , and recovering components requires time .
We can then post-process the vectors to obtain a vector that has correlation with —the details are given in Section 4.3 below.
We will now prove the correctness of Algorithm 4.3 step-by-step, tying details together at the end of this subsection. First, we argue that in step 1, the truncation of the large eigenvalues cannot increase the Frobenius norm of the error.
Suppose that we define to be the result of projecting to the set of tensors whose rectangular reshapings along modes have spectral norm at most , then projecting the result to the set of tensors whose rectangular reshapings along modes have spectral norm at most . Then , and
This operation requires time .
To establish the first claim, we note that the tensor was obtained by two projections of different rectangular reshapings of the matrix to the set of rectangular matrices with singular value at most . This set is closed, convex, and contains , and so the error can only decrease in Frobenius norm (see Lemma A.2 in Appendix A for a proof),
Finally, each reshaping step takes time. Since we are only interested in truncating large singular values, it suffices for us to compute the SVD corresponding to singular values between and . This can be done via subspace power iteration, which here involves the multiplication of a matrix and a matrix (with intermediate orthogonalization steps for the matrix, see [HP14]), which requires time , where is the matrix multiplication constant. Going forward the representation of the matrix will be as the original matrix, with the subtracted SVD corresponding to large singular values. ∎
We will need to argue that if the Frobenius norm of the error matrix is small, this is a sufficient condition under which we succeed. For this, we will use the following two lemmas. The first tells us that with probability over the choice of , we will have for some that
where and furthermore and are small:
Then for a fraction of ,
In particular, if , , , then this probability is .
The proof consists primarily of the application of concentration inequalities, and we provide it below in Section 4.4.
The second lemma states that if indeed has the form above, the top singular vectors of must be close to the component .
with for , and so that the relationship holds. Then letting be a top singular vector of , it follows that
The proof requires some careful calculations, but is not complicated, and we will prove it below in Section 4.4.
Finally, we are ready to stitch these arguments together and prove that Algorithm 4.3 works.
After reshaping and truncating in step of the algorithm, by Lemma 4.5 the matrix has the properties that
and also that still .
We can now apply Lemma 4.6 with and to conclude that for at least a -fraction of the , with probability at least , we will have
where and . Applying Lemma 4.7, we have that either the left- or right- top unit singular vector of has correlation at least
For runtime, by our arguments in Lemma 4.5 step 1 takes time . After this, with either representation of our matrix (whether we compute the full truncated SVD or have the original matrix minus the subtracted SVD), performing power iteration to find the top eigenvector with the flattening takes time , and finding a single component takes samples of random contractions. Since we can reuse with new random contractions, the total runtime for recovering one component is , and by the independence of the runs recovering components requires time. ∎
With the core of our algorithm in place, we now take care of the remaining technical issues: recovery precision, working with near-orthonormal vectors, and recovering the full set of component vectors.
Because the precision of recovery will be important in not amplifying the error, we begin with our precision-amplifying postprocessing algorithm.
Output: If for one of , , output .
Suppose that is a unit vector with , and for and orthonormal. Then if we let be the reshaping of to a matrix, and if we let be the top left- and right- unit singular vectors of , then
In other words, Algorithm 4.8 succeeds. Further, the time required is .
Therefore, defining to be the reshaping of and defining to be the reshaping of ,
where , since .
and that if we choose so that ,
Thus, , and we have by Fact A.3 (see Appendix A for a proof) that the top unit eigenvector of is such that
Choosing , the result follows. ∎
2 Near-orthonormal components
We’ll now dispense with the discrepancy between the orthonormal and near-orthonormal cases.
3 Full Recovery
Now we give the full algorithm, which will remove the components we find in each step from the tensor without amplifying the spectral norm of the error too much.
Initialize the set of known components , and the set of components under inspection .
Initialize a working copy of , , and keep a clean copy of called .
Preprocess with Algorithm 4.1, then run Algorithm 4.3 with times, then postprocess with Algorithm 4.8 using and error parameter . If this produces an output vector , add to (unless already contains a vector that is correlated with ).
Given where the are orthonormal and , then if , with probability , Algorithm 4.11 recovers orthonormal vectors so that there exists a permutation such that for each ,
Furthermore, this requires runtime .
First, we prove that if we have an orthonormal basis that approximates , we can subtract it without introducing a large spectral norm error—this motivates and justifies steps 3(b)–3(e).
So it suffices for us to bound .
By the subadditivity of the norm, . Meanwhile, the singular values of are the square roots of the eigenvalues of , and so we bound
where the second line follows because and have orthonormal columns. Now, by assumption we know that
where for , and , and by the orthonormality of the ,
So the -norm of the rows of is at most . By the orthonormality of the , the same holds for the -norm of the columns, . It follows that . Therefore,
where . Returning to (4.1), we can conclude that , and we have our result. ∎
Where we have used that the spectral norm and nuclear norm are dual. Therefore,
Finally, we are ready to prove that Algorithm 4.11 works.
We claim that in the th iteration of step , with high probability we have at most components remaining to be found, and that where . For , this is easily true.
Now assume this holds for , and we will prove it for . Since by assumption , applying Lemma 4.2 and Theorem 4.4 to the running of preprocessing Algorithm 4.1 and the main step Algorithm 4.3 with and Lemma 4.9 to the running of the postprocessing Algorithm 4.8 with , in step with high probability we will find vectors so that . Furthermore, this takes a total of time.
for a matrix with . By induction, this implies that where .
Taking a union bound over the high-probability success of Algorithm 4.3, we have that after steps we have found all of the components. We have spent a total of time in step 3(a). Finally, steps 3(b)-3(e) of Algorithm 4.11 require no more than time, and since the entire loop runs times, we have our result. ∎
4 Supporting Lemmas
Now we circle back and prove the omitted supporting lemmas.
For convenience, fix . Let be the component of in the direction , and let be the component of orthogonal to . Notice that are independent.
By the orthogonality of the , our matrix can be written as
where is the th matrix slice of . For convenience, we can refer to the two sums on the right as
First, we get a lower bound on the probability that the coefficient of is large. Let be the event that . By standard tail estimates on univariate Gaussians, we have that
Now, we bound . Define the event to be the even that
To bound , it thus remains to understand the term
and then by an application of Markov’s inequality. ∎
Thus, combining the above we have a two-part upper bound on .
Finally, define the event to be the event that
We can apply the same arguments to , and we conclude that
Now, by the union bound and both occur with probability at least . Also, we notice that and are independent. Therefore, for ,
Conditioning on and ,
where , and is a matrix of norm at most , such that .
We now set so that . This occurs when
Choosing , , we have our conclusion for , and by symmetry for all other in the fraction of for which the Frobenius norms of the contractions are small. ∎
Now expanding the term along the components of ,
It is easy to see that when , this quantity is maximized at , and so by our choice of we have that
and thus .
Where we have applied the Cauchy-Schwarz inequality, and the assumption that . It follows that
Finally applying Fact A.3, we can conclude that for either the left- or right-singular unit vector of ,
Choosing as small as possible, we have our result. ∎
Learning Orthonormal Dictionaries
Here, we show how to use our tensor decomposition algorithm to learn dictionaries with orthonormal basis vectors.
Below, in Section 5.3, we will prove that samples suffice to estimate the th moment tensor within spectral norm error. Computing this matrix from samples takes time. Thus we can equivalently formulate the problem as follows:
Finally, given access to a sufficiently large number of samples, we can reduce to the case where the columns of are orthogonal:
The proof is straightforward, involving a transformation by the empirical covariance matrix, and we give it below in Section 5.2.
Reshape to , and perform the eigenvalue truncation
where denotes projection to the PSD cone.
Compute the truncation of a different reshaping of ,
It follows that when we perform the eigenvalue truncation in step 1 of Algorithm 5.4,
We now remark that maps to one of the bounded-norm matrices from Claim 5.6,
Furthermore, because the positive semidefinite cone is a closed convex set, and because projection to closed convex sets can only decrease distances (see Lemma A.2),
Now we prove that the spectral norms of the symmetrizations of the tensor have small spectral norm.
The first matrix that we are interested in is PSD, and can dominated by a tensor power of the identity:
Without loss of generality, let so that (henceforth, we use as an ordinary index). We have that
An identical proof, up to signs, gives us a lower bound of .
For a matrix with .
It remains to argue that the top eigenvector of is . We have that
where the last line follows because is a unit vector, and we chose so that . Therefore
Applying Fact A.3, we conclude that if is the top eigenvector of , then . Since we can choose and still have that , the conclusion follows. ∎
2 From independent columns to orthonormal columns
We now use standard techniques to prove that one can reduce from a dictionary with independent columns to a dictionary with orthogonal columns, given sufficiently many samples.
Note that the expected covariance matrix of the samples is equal to a scaled version of the covariance matrix,
So given sufficiently many samples, we can compute a good spectral approximation of , with
Now, define and . We can factor the difference
Since we can choose the number of samples so as to make this last quantity as small as we would like, as a function of the condition number, and then appealing to Fact 4.10, the reduction is complete. ∎
3 Sample complexity bounds
Below is our bound on the sample complexity of approximating the th moment tensor, which we believe may be loose.
This is because of the orthonormality of the , which guarantees that terms in the product in which we have an inner product between two non-identical vectors drop out to .
References
Appendix A Useful Tools
We compute the expectation and variance of our matrix,
The two variance terms correspond to and respectively. We can now apply concentration results for matrix Gaussian series to conclude the proof [Oli10]. ∎
The following lemma states that distances can only decrease under projections to a convex set, and is well-known (see e.g. [Roc76]).
If we let , ,
Now the conclusion will follow from the fact that
where the second inequality is the triangle inequality. Rearranging, the conclusion follows. ∎