-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Precision errors in KernelPCA #5970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think so, |
I agree with @lucasdavid that this is most likely the culprit. |
@lucasdavid: Well, it looks like passing in
Also, it looks like KernelPCA doesn't accept the |
That would be nice, thanks.
|
The docs seem to be outdated, if you look at the code you'll see the parameter already exists. (mismatch 100.0%)
x: array([[ 4.523470e-02],
[ 9.168905e-03],
[ 1.961695e-02],...
y: array([[ -4.523470e-02],
[ -9.168905e-03],
[ -1.961695e-02],... Please let me know if you find out what's happening. This is too interesting. |
Thanks for the check, @lucasdavid.
I wanted to use I think the negative values in that test are permissible. According to the PCA docs:
However, I'm still getting precision errors from this:
I'm going to update the OP with this error. |
Does this issue seem worthy of the "bug" label? |
I'm not seeing where the second row of your
I'm haven't studied KernelPCA appropriately, Additionally, replacing circles with the s_curve (3D) makes the first 3 columns of My only guess is that the algorithm was implemented to optimize a maximum of Let me know if you don't agree with this. Also, the algorithm didn't flipped the signals once during my tests. Was it updated these last days? |
I think this was fixed in #13241. Current from sklearn.datasets import make_circles
X_circle, y_circle = make_circles(400, random_state=0, factor=0.3, noise=0.15)
from sklearn.decomposition import KernelPCA
from numpy.testing import assert_allclose
kpca = KernelPCA(random_state=0).fit(X_circle)
kpca2 = KernelPCA(n_components=53, random_state=0).fit(X_circle)
assert_allclose(kpca.eigenvalues_, kpca2.eigenvalues_[:2])
assert_allclose(kpca.eigenvectors_, kpca2.eigenvectors_[:, :2]) The |
The following triggers an error. The random state is set, but there are still some precision errors.
Old version of issue, without using random state.
The following is raising an error below, but I don't think it should be:
You could see some signs are flipped, some numbers rounded off, etc. Unless I'm confused about the theory of Kernel PCAs, this shouldn't be raising an error, right?
@mblondel, what do you think?
The text was updated successfully, but these errors were encountered: