smile.projection
Class KPCA<T>
- java.lang.Object
-
- smile.projection.KPCA<T>
-
- All Implemented Interfaces:
- java.io.Serializable, Projection<T>
public class KPCA<T> extends java.lang.Object implements Projection<T>, java.io.Serializable
Kernel principal component analysis. Kernel PCA is an extension of principal component analysis (PCA) using techniques of kernel methods. Using a kernel, the originally linear operations of PCA are done in a reproducing kernel Hilbert space with a non-linear mapping.In practice, a large data set leads to a large Kernel/Gram matrix K, and storing K may become a problem. One way to deal with this is to perform clustering on your large 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.
Kernel PCA with an isotropic kernel function is closely related to metric MDS. Carrying out metric MDS on the kernel matrix K produces an equivalent configuration of points as the distance (2(1 - K(xi, xj)))1/2 computed in feature space.
Kernel PCA also has close connections with Isomap, LLE, and Laplacian eigenmaps.
References
- Bernhard Scholkopf, Alexander Smola, and Klaus-Robert Muller. Nonlinear Component Analysis as a Kernel Eigenvalue Problem. Neural Computation, 1998.
- See Also:
MercerKernel,PCA,IsoMap,LLE,LaplacianEigenmap,SammonMapping, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description KPCA(T[] data, MercerKernel<T> kernel, double threshold)Constructor.KPCA(T[] data, MercerKernel<T> kernel, int k)Constructor.KPCA(T[] data, MercerKernel<T> kernel, int k, double threshold)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[][]getCoordinates()Returns the nonlinear principal component scores, i.e., the representation of learning data in the nonlinear principal component space.DenseMatrixgetProjection()Returns the projection matrix.double[]getVariances()Returns the eigenvalues of kernel principal components, ordered from largest to smallest.double[]project(T x)Project a data point to the feature space.double[][]project(T[] x)Project a set of data toe the feature space.
-
-
-
Constructor Detail
-
KPCA
public KPCA(T[] data, MercerKernel<T> kernel, double threshold)
Constructor. Learn kernel principal component analysis.- Parameters:
data- learning data.kernel- Mercer kernel to compute kernel matrix.threshold- only principal components with eigenvalues larger than the given threshold will be kept.
-
KPCA
public KPCA(T[] data, MercerKernel<T> kernel, int k)
Constructor. Learn kernel principal component analysis.- Parameters:
data- learning data.kernel- Mercer kernel to compute kernel matrix.k- choose upto k principal components (larger than 0.0001) used for projection.
-
KPCA
public KPCA(T[] data, MercerKernel<T> kernel, int k, double threshold)
Constructor. Constructor. Learn kernel principal component analysis.- Parameters:
data- learning data.kernel- Mercer kernel to compute kernel matrix.k- choose top k principal components used for projection.threshold- only principal components with eigenvalues larger than the given threshold will be kept.
-
-
Method Detail
-
getVariances
public double[] getVariances()
Returns the eigenvalues of kernel principal components, ordered from largest to smallest.
-
getProjection
public DenseMatrix getProjection()
Returns the projection matrix. The dimension reduced data can be obtained by y = W * K(x, ·).
-
getCoordinates
public double[][] getCoordinates()
Returns the nonlinear principal component scores, i.e., the representation of learning data in the nonlinear principal component space. Rows correspond to observations, columns to components.
-
project
public double[] project(T x)
Description copied from interface:ProjectionProject a data point to the feature space.- Specified by:
projectin interfaceProjection<T>
-
project
public double[][] project(T[] x)
Description copied from interface:ProjectionProject a set of data toe the feature space.- Specified by:
projectin interfaceProjection<T>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG