Kernel principal component analysis - Kernel principal component analysis - 5.3 English - 68552

AOCL API Guide (68552)

Document_ID
68552
Release_Date
2026-05-13
Version
5.3 English

Kernel PCA Schölkopf et al. [1997] extends standard PCA to capture non-linear structure in data. Given an \(n_{\mathrm{samples}} \times n_{\mathrm{features}}\) data matrix \(X\) whose rows are data points \(x_1, \ldots, x_{n_{\mathrm{samples}}}\), kernel PCA diagonalizes a kernel matrix \(K\) where \(K_{ij} = k(x_i, x_j)\) for a user-selected kernel function \(k\), rather than diagonalizing the covariance matrix of the data directly. This implicitly performs PCA in a (potentially infinite-dimensional) feature space without ever computing the feature map explicitly.

AOCL-DA supports five kernel choices:

  1. Linear Kernel:

    \[k(x, y) = x \cdot y.\]
  2. Polynomial Kernel:

    \[k(x, y) = (\gamma x \cdot y + c)^d.\]
  3. RBF (Radial Basis Function) Kernel:

    \[k(x, y) = \exp(-\gamma \|x - y\|^2).\]
  4. Sigmoid Kernel:

    \[k(x, y) = \tanh(\gamma x \cdot y + c).\]
  5. Precomputed: the user supplies the \(n_{\mathrm{samples}} \times n_{\mathrm{samples}}\) kernel matrix directly via da_kernel_pca_set_data_?.

Note

A kernel matrix must be positive semi-definite (PSD) to represent an inner product in a feature space. Sigmoid kernels are not guaranteed to be PSD. This can produce negative eigenvalues, which are clamped to zero. If large negative eigenvalues are detected, da_status_numerical_difficulties is returned.

Note

When kernel='precomputed', the supplied \(n_{\mathrm{samples}} \times n_{\mathrm{samples}}\) matrix is assumed to be symmetric; symmetry is not verified. The matrix is also assumed to be positive semi-definite. If the eigendecomposition contains large negative eigenvalues, da_status_numerical_difficulties is returned. Inverse transform is not supported with a precomputed kernel.