Problemadvanced
Dictionary learning
Also called sparse dictionary learning.
Find a dictionary of atoms and sparse codes such that every training signal is close to a sparse combination of the atoms.
Dictionary learning is the problem of finding, from many training signals, a set of atoms such that every signal is close to a combination of a few of them. It is the inverse of sparse signal recovery: there the matrix is given and only the sparse vector is unknown, here both are unknown and only the signals are given. It generalizes k-means, where each signal uses one atom with coefficient 1, and principal component analysis, where all signals share one subspace. This page states the problem and what is known about it. K-SVD is one algorithm for it, and convolutional sparse coding is the model in which the atoms are small filters shifted over a whole image.
In plain words
Think of a box of stamps. Every picture in a large collection should be made by pressing only a few stamps, each with its own strength. You do not have the stamps yet. Dictionary learning asks for the box of stamps that does this best for the collection, together with the recipe for each picture. Two things are unknown at once, the stamps and the recipes, and this makes the problem hard. The usual methods fix one, improve the other, and repeat.
Definition
Input. Training signals , the columns of , a number of atoms and a sparsity level .
Output. A dictionary with and codes that solve
Here counts the nonzero entries. The dictionary is overcomplete when , complete when .
Forward model. The usual generative model behind the problem is with an unknown dictionary , codes with at most nonzeros, and noise , often Gaussian. The fit above is the maximum likelihood estimate under Gaussian noise when the codes are only known to be -sparse.
Ambiguities. Permuting the atoms and permuting the rows of in the same way, or changing the sign of an atom and of its row of , does not change . So a solution is at best unique up to these signed permutations. The norm constraint removes the scale ambiguity: without it, and would make any penalty on the size of meaningless.
Uniqueness and stability. Aharon, Elad and Bruckstein showed in 2006 that if the signals are exactly -sparse in with below half the spark of , and the training set contains enough signals in general position on each -dimensional span, then is unique up to the ambiguities. The number of signals their argument needs is large. With noise, results on stability are local: they say that is a local minimum of the objective, or of its form, for many random sparse codes.
Variants
- Penalized form. with , as in online dictionary learning (Mairal, Bach, Ponce and Sapiro 2010). Olshausen and Field used a penalty of the same kind, a smooth function that favors sparse codes. For fixed it is a LASSO problem per signal, which is convex.
- Error target. subject to for all . This form is used for denoising, with set by the noise level.
- Complete and orthogonal dictionaries. With and orthogonal, the codes are thresholded, and the update of is an orthogonal Procrustes problem solved by one singular value decomposition. With an invertible and independent sparse codes the problem is close to independent component analysis.
- Analysis form. Learn an operator such that is sparse, instead of atoms that synthesize . The two forms differ when is redundant; see analysis and synthesis sparsity.
- Convolutional form. The atoms are filters shifted to all positions of a signal. The dictionary is then a union of convolution matrices, and the problem is solved in the Fourier domain. See convolutional sparse coding.
- Structured dictionaries. with a fixed fast transform , for example a wavelet basis, and a sparse matrix . The product is fast to apply and needs fewer training signals.
Examples
Three signals in the plane. Let , and
With the signals lie on the two lines through and . The dictionary , with codes , , gives the error 0, so it is optimal. Swapping the two atoms and changing their signs gives the other optimal pairs, and there are no more: each atom must be parallel to a signal, and both lines must be used.
With every signal uses the same atom , the best code is , and the error is . So is the top eigenvector of
with eigenvalues and . The top eigenvector is , and the least error is , which is : the third signal is lost.
k-means. If and the coefficient of the one chosen atom must be 1, with no normalization of the atoms, the problem is exactly k-means clustering: each signal picks the nearest atom, and each atom is the mean of its signals. Without the coefficient rule, is gain-shape vector quantization: each signal picks the atom with the largest .
Image patches. In the denoising method of Elad and Aharon, the signals are the overlapping patches of an image, so , and the dictionary has atoms. Learned atoms look like localized, oriented edges and textures. Olshausen and Field found the same kind of atoms in 1996 from natural image patches and compared them with the receptive fields of simple cells in the visual cortex.
Known algorithms
| Method | Dictionary update | What is known |
|---|---|---|
| Alternating minimization (Olshausen and Field 1996) | gradient step on after sparse inference for each signal | the objective decreases with small steps; no global guarantee |
| MOD, method of optimal directions (Engan, Aase and Husoy 1999) | , then normalize the atoms | the exact least squares update for fixed ; normalization can increase the error slightly |
| K-SVD (Aharon, Elad and Bruckstein 2006) | one atom at a time, with its coefficients, by the top singular pair of the residual on the signals that use it | the objective does not increase with an exact sparse coder; with OMP it can |
| Online dictionary learning (Mairal, Bach, Ponce and Sapiro 2010) | block coordinate descent on accumulated statistics, one signal or batch at a time | for the form; scales to millions of signals |
| Methods with guarantees (Spielman, Wang and Wright 2012; Arora, Ge and Moitra 2014; Agarwal and coauthors 2014) | spectral or combinatorial starts, then alternating steps | recover in polynomial time under random models of the codes, with incoherent atoms and sparsity of order at most about |
All the practical methods alternate between two steps: a sparse coding step with fixed, which is a sparse signal recovery problem per signal, solved by OMP, basis pursuit or ISTA, and a dictionary update with or its support fixed. Each step can only decrease the objective when it is solved exactly, but the coding step in the form is not solved exactly in practice, and the objective is not convex in together. The result depends on the start, often random signals or a DCT basis.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| K-SVD | O(J N s n (K + n)) worst | O(n (K + N)) extra | not convexdeterministiciterative | 1 language |
Bounds
- Complexity. The sparse coding step alone, finding the best -sparse code for one signal and a fixed dictionary, is NP-hard (Natarajan 1995). Tillmann (2015) proved that dictionary learning itself is NP-hard: deciding whether has an exact factorization with atoms and -sparse columns of is NP-hard, and so is approximating the problem within certain factors. These are worst case results over all inputs.
- Rank bound. has rank at most , so by the Eckart-Young theorem every solution has error at least , the sum of the squared singular values of beyond the -th. For this bound is 0 and says nothing.
- Sample size (a count, not a theorem). The data hold numbers, and the unknowns are dictionary entries plus code values. For the data to have a chance to determine them, , that is . The known guarantees for polynomial time methods need many more signals than this count.
- Local behavior. The alternating methods have no bound on the number of iterations needed to reach a global minimum, and they can stop at local minima with atoms that are never used.
Reductions
- To k-means. With , unit coefficients and no normalization, dictionary learning is k-means, and the alternating method is Lloyd's algorithm. K-SVD was designed as its generalization.
- To principal component analysis. With , the sparsity constraint is empty and the problem is the best rank approximation of , solved by the truncated SVD. The atoms span the top left singular vectors.
- From sparse coding. With fixed, each column of is a separate sparse approximation problem. So every method for dictionary learning contains a sparse recovery solver, and its hardness carries over.
- Union of subspaces. An -sparse code places each signal in one of the subspaces spanned by atoms. Dictionary learning is fitting a union of subspaces with a shared set of spanning vectors, a constrained form of subspace clustering.
Applications
- Denoising. Learn the dictionary from the noisy image's own patches, code each patch with an error target set by the noise, and average the overlapping patches (Elad and Aharon 2006). See image denoising.
- Inpainting. Code each patch from its known pixels only, then fill the missing pixels from the code. See image inpainting.
- Compressed sensing with learned sparsity. A dictionary learned from similar images replaces a fixed wavelet basis in the reconstruction, for example in MRI.
- Compression. Codes with few nonzeros, stored with the indices of their atoms, for classes of signals such as faces.
- Neuroscience. The sparse coding model of Olshausen and Field explains the shape of receptive fields in the primary visual cortex.
References
- Bruno A. Olshausen and David J. Field, Emergence of simple-cell receptive field properties by learning a sparse code for natural images, Nature 381(6583), 1996, pages 607 to 609 (the sparse coding objective, learning by alternating inference and gradient steps, and the localized oriented atoms learned from image patches)
- Kjersti Engan, Sven Ole Aase and John Hakon Husoy, Method of optimal directions for frame design, Proceedings of ICASSP 1999, the whole paper (the least squares dictionary update D = Y X^T (X X^T)^-1)
- Michal Aharon, Michael Elad and Alfred Bruckstein, K-SVD, an algorithm for designing overcomplete dictionaries for sparse representation, IEEE Transactions on Signal Processing 54(11), 2006, pages 4311 to 4322 (the problem with a sparsity constraint, the relation to k-means, and the atom by atom update)
- Michael Elad and Michal Aharon, Image denoising via sparse and redundant representations over learned dictionaries, IEEE Transactions on Image Processing 15(12), 2006, pages 3736 to 3745 (dictionaries learned from the noisy image itself and patch averaging)
- Andreas M. Tillmann, On the computational intractability of exact and approximate dictionary learning, IEEE Signal Processing Letters 22(1), 2015, pages 45 to 49 (NP-hardness of exact dictionary learning and of approximating it)
- B. K. Natarajan, Sparse approximate solutions to linear systems, SIAM Journal on Computing 24(2), 1995, pages 227 to 234 (sparse approximation with a fixed matrix is NP-hard)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 58NV5M Edit this page History Report an error Markdown