Low-rank matrix approximations
Low-rank matrix approximations are essential tools in the application of kernel methods to large-scale learning problems.[1]
Kernel methods (for instance, support vector machines or Gaussian processes[2]) project data points into a high-dimensional or infinite-dimensional feature space and find the optimal splitting hyperplane. In the kernel method the data is represented in a kernel matrix (or, Gram matrix). Many algorithms can solve machine learning problems using the kernel matrix. The main problem of kernel method is its high computational cost associated with kernel matrices. The cost is at least quadratic in the number of training data points, but most kernel methods include computation of matrix inversion or eigenvalue decomposition and the cost becomes cubic in the number of training data. Large training sets cause large storage and computational costs. While low rank decomposition methods (Cholesky decomposition) reduce this cost, they still require computing the kernel matrix. One of the approaches to deal with this problem is low-rank matrix approximations. The most popular examples of them are Nyström method and the random features. Both of them have been successfully applied to efficient kernel learning.
Nyström approximation
Kernel methods become unfeasible when the number of points [math]\displaystyle{ n }[/math] is so large such that the kernel matrix [math]\displaystyle{ \hat{K} }[/math] cannot be stored in memory.
If [math]\displaystyle{ n }[/math] is the number of training examples, the storage and computational cost required to find the solution of the problem using general kernel method is [math]\displaystyle{ O(n^2) }[/math] and [math]\displaystyle{ O(n^3) }[/math] respectively. The Nyström approximation can allow a significant speed-up of the computations.[2][3] This speed-up is achieved by using, instead of the kernel matrix, its approximation [math]\displaystyle{ \tilde{K} }[/math] of rank [math]\displaystyle{ q }[/math]. An advantage of the method is that it is not necessary to compute or store the whole kernel matrix, but only a submatrix of size [math]\displaystyle{ q \times n }[/math].
It reduces the storage and complexity requirements to [math]\displaystyle{ O(nq) }[/math] and [math]\displaystyle{ O(nq^2) }[/math] respectively.
The method is named "Nyström approximation" because it can be interpreted as a case of the Nyström method from integral equation theory.[3]
Theorem for kernel approximation
[math]\displaystyle{ \hat{K} }[/math] is a kernel matrix for some kernel method. Consider the first [math]\displaystyle{ q \lt n }[/math] points in the training set. Then there exists a matrix [math]\displaystyle{ \tilde{K} }[/math] of rank [math]\displaystyle{ q }[/math]:
[math]\displaystyle{ \tilde{K}=\hat{K}_{n,q}\hat{K}_{q}^{-1}\hat{K}_{n,q}^\text{T} }[/math] , where
[math]\displaystyle{ (\hat{K}_q)_{i,j} = K(x_i,x_j), i, j = 1,\dots,q }[/math] ,
[math]\displaystyle{ \hat{K}_q }[/math] is invertible matrix
and
[math]\displaystyle{ (\hat{K}_{n,q})_{i,j} = K(x_i,x_j), i = 1,\dots, n \text{ and } j = 1,\dots,q. }[/math]
Proof
Singular-value decomposition application
Applying singular-value decomposition (SVD) to matrix [math]\displaystyle{ A }[/math] with dimensions [math]\displaystyle{ p \times m }[/math] produces a singular system consisting of singular values [math]\displaystyle{ \{\sigma_j\}_{j=1}^k,\text{ } (\sigma_j \gt 0 \text{ } \forall j=1,\dots,k), }[/math] vectors [math]\displaystyle{ \{v_j\}_{j=1}^m \in \Complex^m }[/math] and [math]\displaystyle{ \{u_j\}_{j=1}^p \in \Complex^p }[/math] such that they form orthonormal bases of [math]\displaystyle{ \Complex^m }[/math] and [math]\displaystyle{ \Complex^p }[/math] respectively:
[math]\displaystyle{ \begin{cases} A^\text{T}Av_j = \sigma_j v_j, \text{ } j=1,\dots,k,\\ A^\text{T}Av_j =0, \text{ } j=k+1,\dots,m,\\ AA^\text{T}u_j=\sigma_j u_j, \text{ } j=1,\dots,k,\\ AA^\text{T}u_j=0, \text{ } j=k+1,\dots,p. \end{cases} }[/math]
If [math]\displaystyle{ U }[/math] and [math]\displaystyle{ V }[/math] are matrices with [math]\displaystyle{ u }[/math]'s and [math]\displaystyle{ v }[/math]'s in the columns and [math]\displaystyle{ \Sigma }[/math] is a diagonal [math]\displaystyle{ p \times m }[/math] matrix having singular values [math]\displaystyle{ \sigma_i }[/math] on the first [math]\displaystyle{ k }[/math]-entries on the diagonal (all the other elements of the matrix are zeros):
[math]\displaystyle{ \begin{cases} Av_j = \sqrt{\sigma_j}u_j, \text{ } j=1,\dots,k, \\ Av_j=0, \text{ } j=k+1,\dots,m, \\ A^\text{T}u_j= \sqrt{\sigma_j}v_j, \text{ } j=1,\dots,k,\\ A^\text{T}u_j=0, \text{ } j=k+1,\dots,p, \end{cases} }[/math]
then the matrix [math]\displaystyle{ A }[/math] can be rewritten as:[4]
[math]\displaystyle{ A=U\Sigma^{1/2}V^\text{T}. }[/math]
Further proof
- [math]\displaystyle{ \hat{X} }[/math] is [math]\displaystyle{ n \times D }[/math] data matrix
- [math]\displaystyle{ \hat{K}=\hat{X}\hat{X}^\text{T} }[/math]
- [math]\displaystyle{ \hat{C}=\hat{X}^\text{T}\hat{X} }[/math]
Applying singular-value decomposition to these matrices: [math]\displaystyle{ \hat{X}=\hat{U}\hat{\Sigma}^{1/2}\hat{V}^\text{T},\text{ }\hat{K}=\hat{U}\hat{\Sigma}\hat{U}^{T}, \text{ } \hat{C}=\hat{V}\hat{\Sigma}\hat{V}^\text{T}. }[/math]
- [math]\displaystyle{ \hat{X}_q }[/math] is the [math]\displaystyle{ q\times D }[/math]-dimensional matrix consisting of the first [math]\displaystyle{ q }[/math] rows of matrix [math]\displaystyle{ \hat{X} }[/math]
- [math]\displaystyle{ \hat{K}_q=\hat{X}_q\hat{X}_q^\text{T} }[/math]
- [math]\displaystyle{ \hat{C}_q=\hat{X}^\text{T}_q \hat{X}_q }[/math]
Applying singular-value decomposition to these matrices:
[math]\displaystyle{ \hat{X}_q=\hat{U}_q\hat{\Sigma}_q^{1/2}\hat{V}_q^\text{T},\text{ }\hat{K}_q=\hat{U}_q\hat{\Sigma}_q\hat{U}_q^{T}, \text{ } \hat{C}_q=\hat{V}_q\hat{\Sigma}_q\hat{V}_q^\text{T}. }[/math]
Since [math]\displaystyle{ \hat{U},\text{ } \hat{V}, \hat{U}_q\text{ and } \hat{V}_q }[/math] are orthogonal matrices,
[math]\displaystyle{ \hat{U}=\hat{X}\hat{V}\hat{\Sigma}^{-1/2}, \text{ }\hat{V}_q=\hat{X}_q^\text{T}\hat{U}_q\hat{\Sigma}_q^{-1/2}. }[/math]
Replacing [math]\displaystyle{ \hat{V}, \hat{\Sigma} }[/math] by [math]\displaystyle{ \hat{V}_q }[/math] and [math]\displaystyle{ \hat{\Sigma}_q }[/math], an approximation for [math]\displaystyle{ \hat{U} }[/math] can be obtained:
[math]\displaystyle{ \tilde{U}=\hat{X}\hat{X}_q^\text{T}\hat{U}_q\hat{\Sigma}_q^{-1} }[/math] ( [math]\displaystyle{ \tilde{U} }[/math] is not necessarily an orthogonal matrix).
However, defining [math]\displaystyle{ \tilde{K}=\tilde{U}\hat{\Sigma}_q \tilde{U}^\text{T} }[/math], it can be computed the next way:
[math]\displaystyle{ \begin{align} \tilde{K}=\tilde{U}\hat{\Sigma}_q \tilde{U}^\text{T} = \hat{X}\hat{X}_q^\text{T}\hat{U}_q\hat{\Sigma}_q^{-1} \hat{\Sigma}_q (\hat{X}\hat{X}_q^\text{T}\hat{U}_q \hat{\Sigma}_q^{-1} )^\text{T} \\ = \hat{X}\hat{X}_q^\text{T}\big\{\hat{U}_q (\hat{\Sigma}_q^{-1})^\text{T}\hat{U}_q^\text{T}\big\}(\hat{X}\hat{X}_q^\text{T})^\text{T} \\ \end{align} }[/math]
By the characterization for orthogonal matrix [math]\displaystyle{ \hat{U}_q }[/math]: equality [math]\displaystyle{ (\hat{U}_q)^\text{T}=(\hat{U}_q)^{-1} }[/math] holds. Then, using the formula for the inverse of matrix multiplication [math]\displaystyle{ (AB)^{-1}=B^{-1}A^{-1} }[/math] for invertible matrices [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math], the expression in braces can be rewritten as:
[math]\displaystyle{ \hat{U}_q (\hat{\Sigma}_q^{-1})^\text{T}\hat{U}_q^\text{T} = (\hat{U}_q \hat{\Sigma}_q^\text{T}\hat{U}_q^\text{T} )^{-1}= (\hat{K}_q)^{-1}. }[/math]
Then the expression for [math]\displaystyle{ \tilde{K} }[/math]: [math]\displaystyle{ \tilde{K}=(\hat{X}\hat{X}_q^\text{T})\hat{K}_q^{-1}(\hat{X}\hat{X}_q^\text{T})^\text{T} . }[/math]
Defining [math]\displaystyle{ \hat{K}_{n,q}=\hat{X}\hat{X}_q^\text{T} }[/math], the proof is finished.
General theorem for kernel approximation for a feature map
For a feature map [math]\displaystyle{ \Phi: \mathcal{X} \to \mathcal{F} }[/math] with associated kernel [math]\displaystyle{ K(x,x') = \langle \Phi(x),\Phi(x')\rangle_\mathcal{F} }[/math]: equality [math]\displaystyle{ \hat{K}=\hat{K}_{n,q}\hat{K}_{q}^{-1}\hat{K}_{n,q}^\text{T} }[/math] also follows by replacing [math]\displaystyle{ \hat{X} }[/math] by the operator [math]\displaystyle{ \hat{\Phi}: \mathcal{F} \to \Reals^n }[/math] such that [math]\displaystyle{ \langle \hat{\Phi}w\rangle_i = \langle \Phi(x_i), w\rangle_\mathcal{F} }[/math], [math]\displaystyle{ \text { } i=1,\dots,n }[/math], [math]\displaystyle{ w \in \mathcal{F} }[/math], and [math]\displaystyle{ \hat{X}_q }[/math] by the operator [math]\displaystyle{ \hat{\Phi}_q: \mathcal{F} \to \Reals^q }[/math] such that [math]\displaystyle{ \langle \hat{\Phi}_q w\rangle_i = \langle \Phi(x_i), w\rangle_\mathcal{F} }[/math], [math]\displaystyle{ \text { } i=1,\dots,q }[/math], [math]\displaystyle{ w \in \mathcal{F} }[/math] . Once again, a simple inspection shows that the feature map is only needed in the proof while the end result only depends on computing the kernel function.
Application for regularized least squares
In a vector and kernel notation, the problem of Regularized least squares can be rewritten as: [math]\displaystyle{ \min_{c \in \Reals^{n}}\frac{1}{n}\|\hat{Y}-\hat{K}c\|^{2}_{\Reals^{n}} + \lambda\langle c,\hat{K}c\rangle_{\Reals^{n}} . }[/math] Computing the gradient and setting in to 0, the minimum can be obtained: [math]\displaystyle{ \begin{align} & -\frac{1}{n}\hat{K}(\hat{Y}-\hat{K}c) + \lambda \hat{K}c = 0 \\ \Rightarrow {} & \hat{K}(\hat{K}+\lambda n I)c = \hat{K} \hat{Y} \\ \Rightarrow {} & c = (\hat{K}+\lambda n I)^{-1}\hat{Y}, \text{ where } c \in \Reals^{n} \end{align} }[/math] The inverse matrix [math]\displaystyle{ (\hat{K}+\lambda n I)^{-1} }[/math] can be computed using Woodbury matrix identity: [math]\displaystyle{ \begin{align} (\hat{K}+\lambda n I)^{-1} &= \frac{1}{\lambda n}\left(\frac{1}{\lambda n}\hat{K} + I\right)^{-1} \\ &= \frac{1}{\lambda n}\left(I + \hat{K}_{n,q}({\lambda n}\hat{K}_{q})^{-1}\hat{K}_{n,q}^\text{T}\right)^{-1} \\ &= \frac{1}{\lambda n}\left(I-\hat{K}_{n,q}(\lambda n\hat{K}_{q}+\hat{K}_{n,q}^\text{T} \hat{K}_{n,q})^{-1}\hat{K}_{n,q}^\text{T}\right) \end{align} }[/math]
It has the desired storage and complexity requirements.
Randomized feature maps approximation
Let [math]\displaystyle{ \mathbf{x}, \mathbf{x'} \in \Reals^d }[/math] – samples of data, [math]\displaystyle{ z: \Reals^d \to \Reals^D }[/math] – a randomized feature map (maps a single vector to a vector of higher dimensionality) so that the inner product between a pair of transformed points approximates their kernel evaluation:
[math]\displaystyle{ K(\mathbf{x}, \mathbf{x'}) = \langle\Phi(\mathbf{x}),\Phi(\mathbf{x'})\rangle \approx z(\mathbf{x})^\text{T}z(\mathbf{x'}), }[/math] where [math]\displaystyle{ \Phi }[/math] is the mapping embedded in the RBF kernel.
Since [math]\displaystyle{ z }[/math] is low-dimensional, the input can be easily transformed with [math]\displaystyle{ z }[/math], after that different linear learning methods to approximate the answer of the corresponding nonlinear kernel can be applied. There are different randomized feature maps to compute the approximations to the RBF kernels. For instance, Random Fourier features and random binning features.
Random Fourier features
Random Fourier features map produces a Monte Carlo approximation to the feature map. The Monte Carlo method is considered to be randomized. These random features consists of sinusoids [math]\displaystyle{ \cos(w^\text{T}\mathbf{x}+b) }[/math] randomly drawn from Fourier transform of the kernel to be approximated, where [math]\displaystyle{ w \in \Reals^d }[/math] and [math]\displaystyle{ b \in \Reals }[/math] are random variables. The line is randomly chosen, then the data points are projected on it by the mappings. The resulting scalar is passed through a sinusoid. The product of the transformed points will approximate a shift-invariant kernel. Since the map is smooth, random Fourier features work well on interpolation tasks.
Random binning features
A random binning features map partitions the input space using randomly shifted grids at randomly chosen resolutions and assigns to an input point a binary bit string that corresponds to the bins in which it falls. The grids are constructed so that the probability that two points [math]\displaystyle{ \mathbf{x}, \mathbf{x'} \in \Reals^d }[/math] are assigned to the same bin is proportional to [math]\displaystyle{ K(\mathbf{x}, \mathbf{x'}) }[/math]. The inner product between a pair of transformed points is proportional to the number of times the two points are binned together, and is therefore an unbiased estimate of [math]\displaystyle{ K(\mathbf{x}, \mathbf{x'}) }[/math]. Since this mapping is not smooth and uses the proximity between input points, Random Binning Features works well for approximating kernels that depend only on the [math]\displaystyle{ L 1 }[/math] distance between datapoints.
Comparison of approximation methods
The approaches for large-scale kernel learning (Nyström method and random features) differs in the fact that the Nyström method uses data dependent basis functions while in random features approach the basis functions are sampled from a distribution independent from the training data. This difference leads to an improved analysis for kernel learning approaches based on the Nyström method. When there is a large gap in the eigen-spectrum of the kernel matrix, approaches based on the Nyström method can achieve better results than Random Features based approach.[5]
See also
External links
- Andreas Müller (2012). Kernel Approximations for Efficient SVMs (and other feature extraction methods).
References
- ↑ Francis R. Bach and Michael I. Jordan (2005). "Predictive low-rank decomposition for kernel methods". ICML.
- ↑ 2.0 2.1 Williams, C.K.I.; Seeger, M. (2001). "Using the Nyström method to speed up kernel machines". Advances in Neural Information Processing Systems 13. http://papers.nips.cc/paper/1866-using-the-nystrom-method-to-speed-up-kernel-machines.
- ↑ 3.0 3.1 Petros Drineas and Michael W. Mahoney (2005). "On the Nyström Method for Approximating a Gram Matrix for Improved Kernel-Based Learning". Journal of Machine Learning Research 6, pp. 2153–2175.
- ↑ C. Eckart, G. Young, The approximation of one matrix by another of lower rank. Psychometrika, Volume 1, 1936, Pages 211–8. doi:10.1007/BF02288367
- ↑ Tianbao Yang, Yu-Feng Li, Mehrdad Mahdavi, Rong Jin and Zhi-Hua Zhou (2012). "Nyström Method vs Random Fourier Features: A Theoretical and Empirical Comparison". Advances in Neural Information Processing Systems 25 (NIPS).
Original source: https://en.wikipedia.org/wiki/Low-rank matrix approximations.
Read more |