Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ppc4le failure of test_pca_dtype_preservation #15774

Closed
@jnothman

Description

@jnothman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions