Low-rank matrix approximations explained
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
is so large such that the kernel matrix
cannot be stored in memory.
If
is the number of training examples, the
storage and computational cost required to find the solution of the problem using general
kernel method is
and
respectively. The Nyström approximation can allow a significant speed-up of the computations.
[3] This speed-up is achieved by using, instead of the kernel matrix, its
approximation
of
rank
. 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
.
It reduces the storage and complexity requirements to
and
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.
Theorem for kernel approximation
is a
kernel matrix for some
kernel method. Consider the first
points in the training set. Then there exists a matrix
of
rank
:
, where
(\hat{K}q)i,j=K(xi,xj),i,j=1,...,q
,
is invertible matrix
and
(\hat{K}n,q)i,j=K(xi,xj),i=1,...,nandj=1,...,q.
Proof
Singular-value decomposition application
Applying singular-value decomposition (SVD) to matrix
with dimensions
produces a
singular system consisting of
singular values
\{\sigmaj\}
(\sigmaj>0\forallj=1,...,k),
vectors
and
such that they form orthonormal bases of
and
respectively:
If
and
are matrices with
's and
's in the columns and
is a
diagonal
matrix having
singular values
on the first
-entries on the diagonal (all the other elements of the matrix are zeros):
then the matrix
can be rewritten as:
[4]
Further proof
is
data matrix
Applying singular-value decomposition to these matrices:
is the
-dimensional matrix consisting of the first
rows of matrix
Applying singular-value decomposition to these matrices:
\hat{X}q=\hat{U}q\hat{\Sigma}
| T,\hat{K} |
\hat{V} | |
| q=\hat{U} |
q\hat{\Sigma}q\hat{U}
,\hat{C}q=\hat{V}q\hat{\Sigma}q\hat{V}
Since
\hat{U},\hat{V},\hat{U}qand\hat{V}q
are
orthogonal matrices,
Replacing
by
and
, an approximation for
can be obtained:
| T\hat{U} |
\tilde{U}=\hat{X}\hat{X} | |
| q\hat{\Sigma} |
(
is not necessarily an
orthogonal matrix).
However, defining
\tilde{K}=\tilde{U}\hat{\Sigma}q\tilde{U}T
, it can be computed the next way:
: equality
holds. Then, using the formula for the inverse of
matrix multiplication
for
invertible matrices
and
, the expression in braces can be rewritten as:
Then the expression for
:
Defining
, the proof is finished.
General theorem for kernel approximation for a feature map
For a feature map
with associated
kernel K(x,x')=\langle\Phi(x),\Phi(x')\ranglel{F}
: equality
also follows by replacing
by the operator
\hat{\Phi}:l{F}\to\Realsn
such that
\langle\hat{\Phi}w\ranglei=\langle\Phi(xi),w\ranglel{F}
,
,
, and
by the operator
\hat{\Phi}q:l{F}\to\Realsq
such that
\langle\hat{\Phi}qw\ranglei=\langle\Phi(xi),w\ranglel{F}
,
,
. 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:Computing the gradient and setting in to 0, the minimum can be obtained:The inverse matrix
can be computed using
Woodbury matrix identity:
It has the desired storage and complexity requirements.
Randomized feature maps approximation
Let
– samples of data,
– 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:
where
is the mapping embedded in the
RBF kernel.
Since
is low-dimensional, the input can be easily transformed with
, 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
randomly drawn from
Fourier transform of the
kernel to be approximated, where
and
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
are assigned to the same bin is proportional to
. 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
. 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
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
Notes and References
- Francis R. Bach and Michael I. Jordan (2005). "Predictive low-rank decomposition for kernel methods". ICML.
- Williams, C.K.I. . Seeger, M. . Using the Nyström method to speed up kernel machines. Advances in Neural Information Processing Systems. 2001. 13 .
- 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.
- 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).