public class KPCA<T> extends java.lang.Object implements Projection<T>, java.io.Serializable
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.
MercerKernel
,
PCA
,
IsoMap
,
LLE
,
LaplacianEigenmap
,
SammonMapping
,
Serialized FormConstructor and Description |
---|
KPCA(T[] data,
smile.math.kernel.MercerKernel<T> kernel,
double threshold)
Constructor.
|
KPCA(T[] data,
smile.math.kernel.MercerKernel<T> kernel,
int k)
Constructor.
|
KPCA(T[] data,
smile.math.kernel.MercerKernel<T> kernel,
int k,
double threshold)
Constructor.
|
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.
|
double[][] |
getProjection()
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.
|
public KPCA(T[] data, smile.math.kernel.MercerKernel<T> kernel, double threshold)
data
- learning data.kernel
- Mercer kernel to compute kernel matrix.threshold
- only principal components with eigenvalues larger than
the given threshold will be kept.public KPCA(T[] data, smile.math.kernel.MercerKernel<T> kernel, int k)
data
- learning data.kernel
- Mercer kernel to compute kernel matrix.k
- choose upto k principal components (larger than 0.0001) used for projection.public KPCA(T[] data, smile.math.kernel.MercerKernel<T> kernel, int k, double threshold)
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.public double[] getVariances()
public double[][] getProjection()
public double[][] getCoordinates()
public double[] project(T x)
Projection
project
in interface Projection<T>
public double[][] project(T[] x)
Projection
project
in interface Projection<T>