MultivariateStats.jl icon indicating copy to clipboard operation
MultivariateStats.jl copied to clipboard

KernelPCA reconstruct problem

Open hzgzh opened this issue 1 year ago • 1 comments

I try using KernelPCA to transform and reconstruct the data, but original data and reconstruct data is not approx.

using Plots,MultivariateStats
x = rand(10,100)
m = fit(KernelPCA,x;inverse =true
y=reconstruct(m, predict(m, x))
plot([x[1,:] y[1,:])

how to make the reconstruct data approximate the origin data

hzgzh avatar Jul 14 '22 05:07 hzgzh

Kernel PCA reconstructions is always approximate, especially out-of-sample, as it generally requires solving a quadratic optimization problem. So, the reconstruction will be always off with respect to the original data. The package uses a heuristic for an approximate reconstruction, i.e. quadratic optimization, which produces even worst approximation. See https://github.com/JuliaStats/MultivariateStats.jl/issues/125 for references.

wildart avatar Jul 19 '22 02:07 wildart