Jump to content

Kernel principal component analysis: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Citation bot (talk | contribs)
Added bibcode. | Use this bot. Report bugs. | Suggested by Dominic3203 | [[Category:Signal processing] | #UCB_Category 216/293
 
(31 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{Short description|Multivariate statistical technique}}
In the field of [[multivariate statistics]], '''kernel principal component analysis (kernel PCA)'''
<ref>{{cite journal | doi = 10.1162/089976698300017467 | volume=10 | title=Nonlinear Component Analysis as a Kernel Eigenvalue Problem | year=1998 | journal=Neural Computation | pages=1299–1319 | last1 = Schölkopf | first1 = Bernhard}}</ref>
In the field of [[multivariate statistics]], '''kernel principal component analysis (kernel PCA)'''<ref>{{cite journal | doi = 10.1162/089976698300017467 | volume=10 | issue=5 | title=Nonlinear Component Analysis as a Kernel Eigenvalue Problem | year=1998 | journal=Neural Computation | pages=1299–1319 | last1 = Schölkopf | first1 = Bernhard| author2-last=Smola| author2-first=Alex| author3-last=Müller| author3-first=Klaus-Robert|author-link3=Klaus-Robert Müller| citeseerx=10.1.1.100.3636 | s2cid=6674407 }}</ref>
is an extension of [[principal component analysis]] (PCA) using techniques of [[kernel methods]]. Using a kernel, the originally linear operations of PCA are performed in a [[reproducing kernel Hilbert space]].
is an extension of [[principal component analysis]] (PCA) using techniques of [[kernel methods]]. Using a kernel, the originally linear operations of PCA are performed in a [[reproducing kernel Hilbert space]].


==Background: Linear PCA==
==Background: Linear PCA==

Recall that conventional PCA operates on zero-centered data; that is,
Recall that conventional PCA operates on zero-centered data; that is,
:<math>\frac{1}{N}\sum_{i=1}^N \mathbf{x}_i = \mathbf{0}</math>,
:<math>\frac{1}{N}\sum_{i=1}^N \mathbf{x}_i = \mathbf{0}</math>,
where <math>\mathbf{x}_i</math> is the vector of one of the <math>N</math> multivariate observations.
where <math>\mathbf{x}_i</math> is one of the <math>N</math> multivariate observations.
It operates by diagonalizing the [[covariance matrix]],
It operates by diagonalizing the [[covariance matrix]],
:<math>C=\frac{1}{N}\sum_{i=1}^N \mathbf{x}_i\mathbf{x}_i^\top</math>
:<math>C=\frac{1}{N}\sum_{i=1}^N \mathbf{x}_i\mathbf{x}_i^\top</math>
Line 13: Line 12:
:<math>\lambda \mathbf{v}=C\mathbf{v}</math>
:<math>\lambda \mathbf{v}=C\mathbf{v}</math>
which can be rewritten as
which can be rewritten as
:<math>\lambda \mathbf{x}_i^\top \mathbf{v}=\mathbf{x}_i^\top C\mathbf{v} \quad\forall i\in [1,N]</math>.<ref>[http://www.face-rec.org/algorithms/Kernel/kernelPCA_scholkopf.pdf Nonlinear Component Analysis as a Kernel Eigenvalue Problem (Technical Report)]</ref>
:<math>\lambda \mathbf{x}_i^\top \mathbf{v}=\mathbf{x}_i^\top C\mathbf{v} \quad \textrm{for}~i=1,\ldots,N</math>.<ref>{{cite tech report |url=http://www.face-rec.org/algorithms/Kernel/kernelPCA_scholkopf.pdf |title=Nonlinear Component Analysis as a Kernel Eigenvalue Problem |publisher=Max-Planck-Institut für biologische Kybernetik |date=December 1996 |id=44 |first1=Bernhard |last1=Scholkopf |first2=Alexander |last2=Smola |first3=Klaus-Robert |last3=Müller }}</ref>
(See also: [[Covariance matrix#As a linear operator|Covariance matrix as a linear operator]])
(See also: [[Covariance matrix#Covariance matrix as a linear operator|Covariance matrix as a linear operator]])


==Introduction of the Kernel to PCA==
==Introduction of the Kernel to PCA==
To understand the utility of kernel PCA, particularly for clustering, observe that, while ''N'' points cannot, in general, be [[linear separability|linearly separated]] in <math>d < N</math> dimensions, they can [[almost always]] be linearly separated in <math>d \geq N</math> dimensions. That is, given ''N'' points, <math>\mathbf{x}_i</math>, if we map them to an ''N''-dimensional space with

To understand the utility of kernel PCA, particularly for clustering, observe that, while ''N'' points cannot in general be [[linear separability|linearly separated]] in <math>d < N</math> dimensions, they can [[almost always]] be linearly separated in <math>d \geq N</math> dimensions. That is, given ''N'' points, <math>\mathbf{x}_i</math>, if we map them to an ''N''-dimensional space with
:<math>\Phi(\mathbf{x}_i)</math> where <math>\Phi : \mathbb{R}^d \to \mathbb{R}^N</math>,
:<math>\Phi(\mathbf{x}_i)</math> where <math>\Phi : \mathbb{R}^d \to \mathbb{R}^N</math>,
it is easy to construct a [[hyperplane]] that divides the points into arbitrary clusters. Of course, this <math>\Phi</math> creates linearly independent vectors, so there is no covariance on which to perform eigendecomposition ''explicitly'' as we would in linear PCA.
it is easy to construct a [[hyperplane]] that divides the points into arbitrary clusters. Of course, this <math>\Phi</math> creates linearly independent vectors, so there is no covariance on which to perform eigendecomposition ''explicitly'' as we would in linear PCA.
Line 26: Line 24:
:<math>K = k(\mathbf{x},\mathbf{y}) = (\Phi(\mathbf{x}),\Phi(\mathbf{y})) = \Phi(\mathbf{x})^T\Phi(\mathbf{y})</math>
:<math>K = k(\mathbf{x},\mathbf{y}) = (\Phi(\mathbf{x}),\Phi(\mathbf{y})) = \Phi(\mathbf{x})^T\Phi(\mathbf{y})</math>


which represents the inner product space (see [[Gramian matrix]]) of the otherwise intractable feature space. The dual form that arises in the creation of a kernel allows us to mathematically formulate a version of PCA in which we never actually solve the eigenvectors and eigenvalues of the covariance matrix in the <math>\Phi(\mathbf{x})</math>-space (see [[Kernel trick]]). The N-elements in each column of ''K'' represent the dot product of one point of the transformed data with respect to all the transformed points (N points). Some well-known kernels are shown in the example below.
which represents the inner product space (see [[Gramian matrix]]) of the otherwise intractable feature space. The dual form that arises in the creation of a kernel allows us to mathematically formulate a version of PCA in which we never actually solve the eigenvectors and eigenvalues of the covariance matrix in the <math>\Phi(\mathbf{x})</math>-space (see [[Kernel trick]]). The N-elements in each column of ''K'' represent the [[dot product]] of one point of the transformed data with respect to all the transformed points (N points). Some well-known kernels are shown in the example below.


Because we are never working directly in the feature space, the kernel-formulation of PCA is restricted in that it computes not the principal components themselves, but the projections of our data onto those components. To evaluate the projection from a point in the feature space <math>\Phi(\mathbf{x})</math> onto the kth principal component <math>V^k</math> (where superscript k means the component k, not powers of k)
Because we are never working directly in the feature space, the kernel-formulation of PCA is restricted in that it computes not the principal components themselves, but the projections of our data onto those components. To evaluate the projection from a point in the feature space <math>\Phi(\mathbf{x})</math> onto the kth principal component <math>V^k</math> (where superscript k means the component k, not powers of k)


:<math>{\mathbf{V}^k}^T\Phi(\mathbf{x}) =\left(\sum_{i=1}^N \mathbf{a_i}^k\Phi(\mathbf{x_i})\right)^T\Phi(\mathbf{x}) </math>
:<math>{V^k}^T\Phi(\mathbf{x}) =\left(\sum_{i=1}^N \mathbf{a}^k_i\Phi(\mathbf{x}_i)\right)^T\Phi(\mathbf{x}) </math>


We note that <math>\Phi(\mathbf{x_i})^T\Phi(\mathbf{x})</math> denotes dot product, which is simply the elements of the kernel <math>K</math>. It seems all that's left is to calculate and normalize the <math>\mathbf{a_i}^k</math>, which can be done by solving the eigenvector equation
We note that <math>\Phi(\mathbf{x}_i)^T\Phi(\mathbf{x})</math> denotes dot product, which is simply the elements of the kernel <math>K</math>. It seems all that's left is to calculate and normalize the <math>\mathbf{a}_i^k</math>, which can be done by solving the eigenvector equation


:<math>N \lambda\mathbf{a} =K\mathbf{a}</math>
:<math>N \lambda\mathbf{a} =K\mathbf{a}</math>


where N is the number of data points in the set, and <math>\lambda</math> and <math>\mathbf{a}</math> are the eigenvalues and eigenvectors of K. Then to normalize the eigenvectors <math>\mathbf{a}^k</math>'s, we require that
where <math>N</math> is the number of data points in the set, and <math>\lambda</math> and <math>\mathbf{a}</math> are the eigenvalues and eigenvectors of <math>K</math>. Then to normalize the eigenvectors <math>\mathbf{a}^k</math>, we require that


:<math>1 = (\mathbf{V}^k)^T \mathbf{V}^k</math>
:<math>1 = (V^k)^T V^k</math>


Care must be taken regarding the fact that, whether or not <math>x</math> has zero-mean in its original space, it is not guaranteed to be centered in the feature space (which we never compute explicitly). Since centered data is required to perform an effective principal component analysis, we 'centralize' K to become <math>K'</math>
Care must be taken regarding the fact that, whether or not <math>x</math> has zero-mean in its original space, it is not guaranteed to be centered in the feature space (which we never compute explicitly). Since centered data is required to perform an effective principal component analysis, we '[[Centering matrix|centralize]]' <math>K</math> to become <math>K'</math>


:<math>K' = K - \mathbf{1_N} K - K \mathbf{1_N} + \mathbf{1_N} K \mathbf{1_N}</math>
:<math>K' = K - \mathbf{1_N} K - K \mathbf{1_N} + \mathbf{1_N} K \mathbf{1_N}</math>
Line 48: Line 46:
One caveat of kernel PCA should be illustrated here. In linear PCA, we can use the eigenvalues to rank the eigenvectors based on how much of the variation of the data is captured by each principal component. This is useful for data dimensionality reduction and it could also be applied to KPCA. However, in practice there are cases that all variations of the data are same. This is typically caused by a wrong choice of kernel scale.
One caveat of kernel PCA should be illustrated here. In linear PCA, we can use the eigenvalues to rank the eigenvectors based on how much of the variation of the data is captured by each principal component. This is useful for data dimensionality reduction and it could also be applied to KPCA. However, in practice there are cases that all variations of the data are same. This is typically caused by a wrong choice of kernel scale.


==Large Datasets==
==Large datasets==


In practice, a large data set leads to a large K, and storing K may become a problem. One way to deal with this is to perform clustering on the dataset, and populate the kernel with the means of those clusters. Since even this method may yield a relatively large K, it is common to compute only the top P eigenvalues and eigenvectors of K.
In practice, a large data set leads to a large K, and storing K may become a problem. One way to deal with this is to perform clustering on the dataset, and populate the kernel with the means of those clusters. Since even this method may yield a relatively large K, it is common to compute only the top P eigenvalues and eigenvectors of the eigenvalues are calculated in this way.


==Example==
==Example==
[[Image:Kernel pca input.png|thumb|300px|Input points before kernel PCA]]
[[Image:Kernel pca input.png|thumb|300px|Input points before kernel PCA]]


Consider three concentric clouds of points (shown); we wish to use kernel PCA to identify these groups. The color of the points is not part of the algorithm, but only there to show how the data groups together before and after the transformation.
Consider three concentric clouds of points (shown); we wish to use kernel PCA to identify these groups. The color of the points does not represent information involved in the algorithm, but only shows how the transformation relocates the data points.


First, consider the kernel
First, consider the kernel
Line 76: Line 74:


==Applications==
==Applications==
Kernel PCA has been demonstrated to be useful for novelty detection <ref>{{cite journal | last1 = | first1 = | year = 2007 | title = Kernel PCA for Novelty Detection | url = http://www.heikohoffmann.de/kpca.html | journal = Pattern Recognition | volume = 40 | issue = | pages = 863–874 | doi=10.1016/j.patcog.2006.07.009}}</ref> and image de-noising.<ref>[http://citeseer.ist.psu.edu/old/mika99kernel.html Kernel PCA and De-Noising in Feature Spaces. NIPS, 1999]</ref>
Kernel PCA has been demonstrated to be useful for novelty detection<ref>{{cite journal | last1 = Hoffmann| first1 = Heiko| year = 2007 | title = Kernel PCA for Novelty Detection | url = http://www.heikohoffmann.de/kpca.html | journal = Pattern Recognition | volume = 40 | issue = 3| pages = 863–874 | doi=10.1016/j.patcog.2006.07.009| bibcode = 2007PatRe..40..863H}}</ref> and image de-noising.<ref>[http://citeseer.ist.psu.edu/old/mika99kernel.html Kernel PCA and De-Noising in Feature Spaces. NIPS, 1999]</ref>


==See also==
==See also==
* [[Cluster analysis]]
* [[Cluster analysis]]
* [[Kernel trick]]
* [[Multilinear principal component analysis|Multilinear PCA]]
* [[Multilinear subspace learning]]
* [[Nonlinear dimensionality reduction]]
* [[Nonlinear dimensionality reduction]]
* [[Spectral clustering]]
* [[Spectral clustering]]

Latest revision as of 05:17, 19 May 2024

In the field of multivariate statistics, kernel principal component analysis (kernel PCA)[1] is an extension of principal component analysis (PCA) using techniques of kernel methods. Using a kernel, the originally linear operations of PCA are performed in a reproducing kernel Hilbert space.

Background: Linear PCA

[edit]

Recall that conventional PCA operates on zero-centered data; that is,

,

where is one of the multivariate observations. It operates by diagonalizing the covariance matrix,

in other words, it gives an eigendecomposition of the covariance matrix:

which can be rewritten as

.[2]

(See also: Covariance matrix as a linear operator)

Introduction of the Kernel to PCA

[edit]

To understand the utility of kernel PCA, particularly for clustering, observe that, while N points cannot, in general, be linearly separated in dimensions, they can almost always be linearly separated in dimensions. That is, given N points, , if we map them to an N-dimensional space with

where ,

it is easy to construct a hyperplane that divides the points into arbitrary clusters. Of course, this creates linearly independent vectors, so there is no covariance on which to perform eigendecomposition explicitly as we would in linear PCA.

Instead, in kernel PCA, a non-trivial, arbitrary function is 'chosen' that is never calculated explicitly, allowing the possibility to use very-high-dimensional 's if we never have to actually evaluate the data in that space. Since we generally try to avoid working in the -space, which we will call the 'feature space', we can create the N-by-N kernel

which represents the inner product space (see Gramian matrix) of the otherwise intractable feature space. The dual form that arises in the creation of a kernel allows us to mathematically formulate a version of PCA in which we never actually solve the eigenvectors and eigenvalues of the covariance matrix in the -space (see Kernel trick). The N-elements in each column of K represent the dot product of one point of the transformed data with respect to all the transformed points (N points). Some well-known kernels are shown in the example below.

Because we are never working directly in the feature space, the kernel-formulation of PCA is restricted in that it computes not the principal components themselves, but the projections of our data onto those components. To evaluate the projection from a point in the feature space onto the kth principal component (where superscript k means the component k, not powers of k)

We note that denotes dot product, which is simply the elements of the kernel . It seems all that's left is to calculate and normalize the , which can be done by solving the eigenvector equation

where is the number of data points in the set, and and are the eigenvalues and eigenvectors of . Then to normalize the eigenvectors , we require that

Care must be taken regarding the fact that, whether or not has zero-mean in its original space, it is not guaranteed to be centered in the feature space (which we never compute explicitly). Since centered data is required to perform an effective principal component analysis, we 'centralize' to become

where denotes a N-by-N matrix for which each element takes value . We use to perform the kernel PCA algorithm described above.

One caveat of kernel PCA should be illustrated here. In linear PCA, we can use the eigenvalues to rank the eigenvectors based on how much of the variation of the data is captured by each principal component. This is useful for data dimensionality reduction and it could also be applied to KPCA. However, in practice there are cases that all variations of the data are same. This is typically caused by a wrong choice of kernel scale.

Large datasets

[edit]

In practice, a large data set leads to a large K, and storing K may become a problem. One way to deal with this is to perform clustering on the dataset, and populate the kernel with the means of those clusters. Since even this method may yield a relatively large K, it is common to compute only the top P eigenvalues and eigenvectors of the eigenvalues are calculated in this way.

Example

[edit]
Input points before kernel PCA

Consider three concentric clouds of points (shown); we wish to use kernel PCA to identify these groups. The color of the points does not represent information involved in the algorithm, but only shows how the transformation relocates the data points.

First, consider the kernel

Applying this to kernel PCA yields the next image.

Output after kernel PCA with . The three groups are distinguishable using the first component only.

Now consider a Gaussian kernel:

That is, this kernel is a measure of closeness, equal to 1 when the points coincide and equal to 0 at infinity.

Output after kernel PCA, with a Gaussian kernel.

Note in particular that the first principal component is enough to distinguish the three different groups, which is impossible using only linear PCA, because linear PCA operates only in the given (in this case two-dimensional) space, in which these concentric point clouds are not linearly separable.

Applications

[edit]

Kernel PCA has been demonstrated to be useful for novelty detection[3] and image de-noising.[4]

See also

[edit]

References

[edit]
  1. ^ Schölkopf, Bernhard; Smola, Alex; Müller, Klaus-Robert (1998). "Nonlinear Component Analysis as a Kernel Eigenvalue Problem". Neural Computation. 10 (5): 1299–1319. CiteSeerX 10.1.1.100.3636. doi:10.1162/089976698300017467. S2CID 6674407.
  2. ^ Scholkopf, Bernhard; Smola, Alexander; Müller, Klaus-Robert (December 1996). Nonlinear Component Analysis as a Kernel Eigenvalue Problem (PDF) (Technical report). Max-Planck-Institut für biologische Kybernetik. 44.
  3. ^ Hoffmann, Heiko (2007). "Kernel PCA for Novelty Detection". Pattern Recognition. 40 (3): 863–874. Bibcode:2007PatRe..40..863H. doi:10.1016/j.patcog.2006.07.009.
  4. ^ Kernel PCA and De-Noising in Feature Spaces. NIPS, 1999