k-SVD

From HandWiki
Short description: Dictionary learning algorithm

In applied mathematics, k-SVD is a dictionary learning algorithm for creating a dictionary for sparse representations, via a singular value decomposition approach. k-SVD is a generalization of the k-means clustering method, and it works by iteratively alternating between sparse coding the input data based on the current dictionary, and updating the atoms in the dictionary to better fit the data. It is structurally related to the expectation maximization (EM) algorithm.[1][2] k-SVD can be found widely in use in applications such as image processing, audio processing, biology, and document analysis.

k-SVD algorithm

k-SVD is a kind of generalization of k-means, as follows. The k-means clustering can be also regarded as a method of sparse representation. That is, finding the best possible codebook to represent the data samples [math]\displaystyle{ \{y_i\}^M_{i=1} }[/math] by nearest neighbor, by solving

[math]\displaystyle{ \quad \min \limits _{D, X} \{ \|Y - DX\|^2_F\} \qquad \text{subject to } \forall i, x_i = e_k \text{ for some } k. }[/math]

which is nearly equivalent to

[math]\displaystyle{ \quad \min \limits _{D, X} \{ \|Y - DX\|^2_F\} \qquad \text{subject to }\quad \forall i , \|x_i\|_0 = 1 }[/math]

which is k-means that allows "weights".

The letter F denotes the Frobenius norm. The sparse representation term [math]\displaystyle{ x_i = e_k }[/math] enforces k-means algorithm to use only one atom (column) in dictionary [math]\displaystyle{ D }[/math]. To relax this constraint, the target of the k-SVD algorithm is to represent signal as a linear combination of atoms in [math]\displaystyle{ D }[/math].

The k-SVD algorithm follows the construction flow of the k-means algorithm. However, in contrast to k-means, in order to achieve a linear combination of atoms in [math]\displaystyle{ D }[/math], the sparsity term of the constraint is relaxed so that the number of nonzero entries of each column [math]\displaystyle{ x_i }[/math] can be more than 1, but less than a number [math]\displaystyle{ T_0 }[/math].

So, the objective function becomes

[math]\displaystyle{ \quad \min \limits _{D, X} \{ \|Y - DX\|^2_F \} \qquad \text{subject to } \quad \forall i \;, \|x_i\|_0 \le T_0. }[/math]

or in another objective form

[math]\displaystyle{ \quad \min \limits _{D, X} \sum_{i} \|x_i\|_0 \qquad \text{subject to } \quad \forall i \;, \|Y - DX\|^2_F \le \epsilon. }[/math]

In the k-SVD algorithm, the [math]\displaystyle{ D }[/math] is first fixed and the best coefficient matrix [math]\displaystyle{ X }[/math] is found. As finding the truly optimal [math]\displaystyle{ X }[/math] is hard, we use an approximation pursuit method. Any algorithm such as OMP, the orthogonal matching pursuit can be used for the calculation of the coefficients, as long as it can supply a solution with a fixed and predetermined number of nonzero entries [math]\displaystyle{ T_0 }[/math].

After the sparse coding task, the next is to search for a better dictionary [math]\displaystyle{ D }[/math]. However, finding the whole dictionary all at a time is impossible, so the process is to update only one column of the dictionary [math]\displaystyle{ D }[/math] each time, while fixing [math]\displaystyle{ X }[/math]. The update of the [math]\displaystyle{ k }[/math]-th column is done by rewriting the penalty term as

[math]\displaystyle{ \|Y - DX\|^2_F = \left\| Y - \sum_{j = 1}^K d_j x^\text{T}_j\right\|^2_F = \left\| \left(Y - \sum_{j \ne k} d_j x^\text{T}_j \right) - d_k x^\text{T}_k \right\|^2_F = \| E_k - d_k x^\text{T}_k\|^2_F }[/math]

where [math]\displaystyle{ x_k^\text{T} }[/math] denotes the k-th row of X.

By decomposing the multiplication [math]\displaystyle{ DX }[/math] into sum of [math]\displaystyle{ K }[/math] rank 1 matrices, we can assume the other [math]\displaystyle{ K-1 }[/math] terms are assumed fixed, and the [math]\displaystyle{ k }[/math]-th remains unknown. After this step, we can solve the minimization problem by approximate the [math]\displaystyle{ E_k }[/math] term with a [math]\displaystyle{ rank -1 }[/math] matrix using singular value decomposition, then update [math]\displaystyle{ d_k }[/math] with it. However, the new solution of vector [math]\displaystyle{ x^\text{T}_k }[/math] is very likely to be filled, because the sparsity constraint is not enforced.

To cure this problem, define [math]\displaystyle{ \omega_k }[/math] as

[math]\displaystyle{ \omega_k = \{i \mid 1 \le i \le N , x^\text{T}_k(i) \ne 0\}, }[/math]

which points to examples [math]\displaystyle{ \{ y_i \}_{i=1}^N }[/math] that use atom [math]\displaystyle{ d_k }[/math] (also the entries of [math]\displaystyle{ x_i }[/math] that is nonzero). Then, define [math]\displaystyle{ \Omega_k }[/math] as a matrix of size [math]\displaystyle{ N\times|\omega_k| }[/math], with ones on the [math]\displaystyle{ (i,\omega_k(i))\text{th} }[/math] entries and zeros otherwise. When multiplying [math]\displaystyle{ \tilde{x}^\text{T}_k = x^\text{T}_k\Omega_k }[/math], this shrinks the row vector [math]\displaystyle{ x^\text{T}_k }[/math] by discarding the zero entries. Similarly, the multiplication [math]\displaystyle{ \tilde{Y}_k = Y\Omega_k }[/math] is the subset of the examples that are current using the [math]\displaystyle{ d_k }[/math] atom. The same effect can be seen on [math]\displaystyle{ \tilde{E}_k = E_k\Omega_k }[/math].

So the minimization problem as mentioned before becomes

[math]\displaystyle{ \| E_k\Omega_k - d_k x^\text{T}_k\Omega_k\|^2_F = \| \tilde{E}_k - d_k \tilde{x}^\text{T}_k\|^2_F }[/math]

and can be done by directly using SVD. SVD decomposes [math]\displaystyle{ \tilde{E}_k }[/math] into [math]\displaystyle{ U\Delta V^\text{T} }[/math]. The solution for [math]\displaystyle{ d_k }[/math] is the first column of U, the coefficient vector [math]\displaystyle{ \tilde{x}^\text{T}_k }[/math] as the first column of [math]\displaystyle{ V \times \Delta (1, 1) }[/math]. After updating the whole dictionary, the process then turns to iteratively solve X, then iteratively solve D.

Limitations

Choosing an appropriate "dictionary" for a dataset is a non-convex problem, and k-SVD operates by an iterative update which does not guarantee to find the global optimum.[2] However, this is common to other algorithms for this purpose, and k-SVD works fairly well in practice.[2][better source needed]

See also

References

  1. IEEE Transactions on Signal Processing 54 (11): 4311–4322, 2006, doi:10.1109/TSP.2006.881199, Bibcode2006ITSP...54.4311A, https://elad.cs.technion.ac.il/wp-content/uploads/2018/02/32_KSVD_IEEE_TSP.pdf 
  2. 2.0 2.1 2.2 Rubinstein, R., Bruckstein, A.M., and Elad, M. (2010), "Dictionaries for Sparse Representation Modeling", Proceedings of the IEEE 98 (6): 1045–1057, doi:10.1109/JPROC.2010.2040551