Suppose I have high dimensional data (say 32 dimension) and I projected the data onto 2D space. How can I project (or approximate) these 2 dimensional point back onto the original 32 dimensions. \
In particular, I wish to approximate any random point in 2D to the original space. Explanation through python code is much appreciated.
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
You can direct do that in sklearn with inverse_transform().
from sklearn.decomposition import PCA
import numpy as np
X=np.random.rand(100,32)
pca = PCA(n_components=2)
pca.fit(X)
X_reduced=pca.transform(X)
X_inverse=pca.inverse_transform(X_reduced)
Trying with random arrays you see that the operation is not biunivocal because it not necessary produce the original X input.
But if you try to reduce the "inverse" X:
X_inv_red=pca.transform(X_inverse)
You get the same PCA reduction as the original X input.
You can use it in whatever 2D point.