-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Something goes wrong with KernelPCA with 32 bits input data #18146
Copy link
Copy link
Closed
Labels
Description
When given 32 bits input, KernelPCA succeed to transform the data into a 17-dimensional feature space while the original space was 3 features. I did not debug yet but this seems really unlikely.
# %%
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
X, y = make_blobs(
n_samples=30,
centers=[[0, 0, 0], [1, 1, 1]],
random_state=0,
cluster_std=0.1
)
X = StandardScaler().fit_transform(X)
X -= X.min()
# %%
import numpy as np
from sklearn.decomposition import KernelPCA
kpca = KernelPCA()
print(kpca.fit_transform(X).shape)
print(kpca.fit_transform(X.astype(np.float32)).shape)Reactions are currently unavailable