We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
From https://travis-ci.org/conda-forge/scikit-learn-feedstock/builds/620255817?utm_source=github_status&utm_medium=notification
______________________ test_pca_dtype_preservation[full] _______________________ svd_solver = 'full' @pytest.mark.parametrize('svd_solver', PCA_SOLVERS) def test_pca_dtype_preservation(svd_solver): > check_pca_float_dtype_preservation(svd_solver) ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/python3.6/site-packages/sklearn/decomposition/tests/test_pca.py:515: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ svd_solver = 'full' def check_pca_float_dtype_preservation(svd_solver): # Ensure that PCA does not upscale the dtype when input is float32 X_64 = np.random.RandomState(0).rand(1000, 4).astype(np.float64, copy=False) X_32 = X_64.astype(np.float32) pca_64 = PCA(n_components=3, svd_solver=svd_solver, random_state=0).fit(X_64) pca_32 = PCA(n_components=3, svd_solver=svd_solver, random_state=0).fit(X_32) assert pca_64.components_.dtype == np.float64 assert pca_32.components_.dtype == np.float32 assert pca_64.transform(X_64).dtype == np.float64 assert pca_32.transform(X_32).dtype == np.float32 > assert_allclose(pca_64.components_, pca_32.components_, rtol=1e-4) E AssertionError: E Not equal to tolerance rtol=0.0001, atol=0 E E Mismatch: 16.7% E Max absolute difference: 1.70156909e-05 E Max relative difference: 0.00010702 E x: array([[ 0.620224, 0.159835, -0.38317 , -0.66555 ], E [ 0.263179, 0.240851, 0.908007, -0.21966 ], E [-0.124977, -0.881087, 0.167274, -0.424366]]) E y: array([[ 0.620221, 0.159831, -0.383173, -0.665551], E [ 0.263179, 0.240834, 0.908009, -0.219671], E [-0.124991, -0.881089, 0.167257, -0.424363]], dtype=float32)
cf. #12823
The text was updated successfully, but these errors were encountered:
I think we need to bump the tol to 2e-4. The components_ are obtained directly from linalg.svd here:
tol
components_
linalg.svd
scikit-learn/sklearn/decomposition/_pca.py
Lines 447 to 451 in 479548a
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
From https://travis-ci.org/conda-forge/scikit-learn-feedstock/builds/620255817?utm_source=github_status&utm_medium=notification
cf. #12823
The text was updated successfully, but these errors were encountered: