Solving the pre-image problem in kernel PCA: The reproducing property is all you need
Authors: Joel-Pascal Ntwali N'konzi, Stefan Klus
Organizations: Maxwell Institute for Mathematical Sciences, University of Edinburgh & Heriot–Watt University, Edinburgh, United Kingdom · School of Mathematical and Computer Sciences, Heriot–Watt University, Edinburgh, United Kingdom
Kernel PCA extends PCA to nonlinear dimensionality reduction by implicitly mapping data into a reproducing kernel Hilbert space (RKHS) via the kernel trick, with applications ranging from image denoising to out-of-distribution detection. While its projection map is well understood, appropriately defining the associated reconstruction map is a longstanding challenge since projecting back from the RKHS to the input space is non-trivial. This is known as the pre-image problem. Existing approaches have tackled this problem by either relying on nonlinear optimization, which is prone to numerical instabilities and sensitive to initialization, or by solving a separate supervised learning problem, incurring additional computational overhead. Furthermore, although the projection map of kernel PCA reduces to that of standard PCA when a linear kernel is used, most of these approaches are not guaranteed to recover PCA's reconstruction map in this case, a consistency property that one would naturally expect to hold. In this paper, we leverage the reproducing property of the RKHS to derive a reconstruction map for kernel PCA that is provably consistent. Our derivations rely on the mild assumption that the RKHS either contains linear functions or the kernel is universal, which holds for standard kernels. We further extend the method to the random Fourier features (RFFs) approximation of kernel PCA by introducing a corresponding notion of RFF reproducing property. Numerical experiments on synthetic and real-world datasets demonstrate that the proposed method performs comparably with state-of-the-art methods across kernel choices, while remaining more computationally efficient and maintaining consistent performance in settings where these baseline methods drastically fail.
Figures & tables
Fig. 1: Two circles experiment. Training and test data.
Fig. 2: Two circles experiment. Projection onto the first two principal components using PCA, KPCA, and KPCA-RFF. In contrast to KPCA and KPCA-RFF, PCA fails to linearly separate data from the two circles.
Fig. 3: Two circles experiment. Reconstruction of the test data based on all the principal components for both KPCA and KPCA-RFF. Some baselines have been omitted due to space constraints. B.W.S. and T.R. correspond to algorithms from [ 35 ] and [ 52 ] , respectively.
Fig. 4: Image denoising on USPS digits. Representative results showing 25 randomly selected examples from the test set obtained using the RBF kernel. The noise level is σ=0.25 . The panels compare the ground truth, noisy inputs, our method, and existing approaches. Metrics below each image grid report MSE, SSIM, and PSNR averaged over the full test set of 1000 examples.
σ=0
σ=0.1
σ=0.25
σ=0.5
Kernel
Metric
B.W.S.
H.R.
Ours
B.W.S.
H.R.
Ours
B.W.S.
H.R.
Ours
B.W.S.
H.R.
Ours
q=50
RBF
MSE ( ↓ )
3.1e-03
5.5e-03
5.5e-03
6.2e-03
7.5e-03
7.4e-03
1.7e-02
1.9e-02
1.7e-02
4.1e-02
6.1e-02
4.1e-02
SSIM ( ↑ )
0.99
0.98
0.98
0.97
0.97
0.97
0.92
0.92
0.92
0.82
0.80
0.82
PSNR ( ↑ )
33.0
29.8
29.8
28.6
27.8
27.9
24.1
23.4
24.1
20.1
18.3
20.1
Poly
MSE ( ↓ )
3.1e-03
5.5e-03
5.5e-03
6.2e-03
7.5e-03
7.4e-03
1.7e-02
1.9e-02
1.7e-02
4.2e-02
6.1e-02
4.2e-02
TABLE I: USPS digits data: reconstruction metrics across kernels, numbers of retained components, noise levels, and methods (B.W.S. corresponds to the method of [ 35 ] and H.R. to that of [ 32 ] ). Bold values indicate the best result for each metric and noise level, while underlined values indicate ties at the displayed precision.
Fig. 5: Computational requirements (elapsed time in seconds and peak memory usage in megabyte) for each KPCA pre-image algorithm vs. the number of (a) test and (b) training examples. We did not include the A.H. method [ 11 ] for the sake of readability. However, its complexity is comparable to M. et al. [ 7 ] .
Fig. 6: Comparison of KPCA-RFF pre-image algorithms using the USPS dataset. We only use the test data MSE as a performance metric. However, the results are similar for the SSIM and PNSR. We further report the computational requirements (elapsed time in seconds and peak memory usage in megabyte) of each algorithm, where T.R. refers to the first method of [ 52 ] . (a) Effect of kernel bandwidth for fixed ntrain=6000,ntest=2000 , nRFFs=2000 , and number of components q=50 . (b) Effect of the number of RFFs for fixed σRBF=50,ntrain=8000,ntest=1000,q=50 . (c) Effect of training data size for fixed σRBF=50,nRFFs=2000,ntest=1000,q=50 . (d) Effect of the number of principal components for fixed σRBF=50,ntrain=6000,ntest=2000 , and nRFFs=2000 .
σRBF
Measure
B.W.S. [ 35 ]
Ours
T.R. [ 52 ]
5
MSE
1.2×10−1
1.4×10−2
1.4×10−2
SSIM
0.10
0.67
0.67
PSNR (dB)
9.8
19.1
19.1
Time (s)
30.3
4.0
10.1
Memory (MB)
1880.0
963.0
1878.5
10
MSE
3.2×10−2
7.6×10−3
7.6×10−3
TABLE II: MNIST: Reconstruction quality, runtime and memory.
σRBF
Measure
B.W.S. [ 35 ]
Ours
T.R. [ 52 ]
5
MSE
1.9×10−1
4.1×10−2
4.1×10−2
SSIM
0.06
0.37
0.37
PSNR (dB)
8.8
15.3
15.3
Time (s)
38.8
5.3
13.6
Memory (MB)
1605.0
1212.5
1565.7
10
MSE
8.6×10−2
1.6×10−2
1.6×10−2
TABLE III: CIFAR-10: Reconstruction quality, runtime and memory.
Fig. 7: KPCA-RFF autoencoder on MNIST. Reconstruction of unseen images using the proposed method. Metrics are averaged over the full test set.
Fig. 8: KPCA-RFF autoencoder on CIFAR-10. Reconstruction of unseen images using the proposed method. Metrics are averaged over the full test set.
We show that, up to isotropic scaling, the Gaussian RBF reproducing kernel Hilbert space (RKHS) is asymptotically isometric to Euclidean space in the large bandwidth limit. This strongly suggests that kernel-based constructions reliant on metric properties of the RKHS will yield results for Gaussian RBF kernels that similarly approach those of linear kernels for large bandwidths. The asymptotic behavior of Gaussian CKA can be understood in this light. We further consider kernel PCA, showing that Gaussian RBF eigenvalues, eigenprojections, and principal components all converge to those of classical (linear) PCA as bandwidth σ→∞. For a given data representation, both the RKHS feature embeddings and the orthogonal PCA eigenframes of the two kernel types differ asymptotically by a geometric similarity transformation, up to a residual of size O(σρ)2, where ρ is a measure of geometric eccentricity of the representation, equal to the ratio of maximum to median pairwise distance between data examples. Experiments over a diverse collection of data sets demonstrate that ρ provides a simple and reliable predictor of dataset-specific convergence behavior in the top principal directions.
Sergio A. Alvarez
Department of Computer Science, Boston College, Chestnut Hill, MA 02467 USA
While principal component analysis (PCA) is a fundamental tool for dimensionality reduction, its dense representations make it ill-suited for high-dimensional data. Existing methods address this by promoting sparsity through explicit ℓ1-penalties, but these are not obvious to tune due to the unsupervised nature of the task. In contrast, we propose Adversarial PCA (AdvPCA), which leverages robust optimization to achieve sparsity by optimizing the reconstruction objective against bounded, worst-case latent space perturbations. We show that this formulation admits a closed-form reduction, leading to a practical iterative algorithm that alternates between adversarial linear regression-style updates for the sparse encoder and orthogonal updates for the decoder. By theoretically characterizing the solution, we derive a data-adaptive parameterization that allows the algorithm to perform effectively out of the box. We validate these claims through numerical experiments on synthetic and real-world genomics data.
David Vävinggren, Francis Bach, André M. H. Teixeira +2
Uppsala University, Sweden · PSL Research University / INRIA, France · Science for Life Laboratory, Sweden
Machine learning models process large amounts of data, and Principal Component Analysis (PCA) is a widely used technique to reduce the dimensionality of the data and extract useful features. In practice, datasets often change over time (data drift) and/or arrive one sample at a time (streaming data), making it infeasible to process the entire dataset at once in batch mode. Real-world data also often contains nonlinear patterns, which traditional PCA cannot extract. Kernel PCA addresses this by implicitly mapping samples into a Reproducing Kernel Hilbert Space (RKHS). Raw data also often contains outliers, which can have an outsized effect on the estimated subspace unless the algorithm is made robust. However, existing online robust kernel PCA algorithms are designed to converge to a subspace that is assumed to be fixed, and gradient-descent-based updates lose their effectiveness at tracking further changes once this initial alignment is achieved. This paper introduces a rotation-based update mechanism, which updates the subspace estimate by rotating it toward each new incoming feature vector in Reproducing Kernel Hilbert Space, rather than relying on gradient descent alone. We present two complementary rotation strategies, and show that the extent of rotation can be moderated by a robust influence function to mitigate the effect of outliers. Through experiments on synthetic streaming data with a known ground-truth subspace, we show that per-sample rotations converge faster than gradient descent alone, demonstrating an effective mechanism for dynamically tracking a nonlinear subspace in streaming data.
Kris Lokere, John Fossaceca
Harvard University, Cambridge, MA, USA · George Washington University, Washington, DC, USA