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

Skip to content

Consistent failure on OSX in draft 0.20.2 #12823

Closed
@jnothman

Description

@jnothman

While trying to build wheels for 0.20.2, all Mac builds have failed (e.g. https://travis-ci.org/MacPython/scikit-learn-wheels/jobs/469752588) with:


___________________ test_pca_dtype_preservation[randomized] ____________________
svd_solver = 'randomized'
    @pytest.mark.parametrize('svd_solver', solver_list)
    def test_pca_dtype_preservation(svd_solver):
>       check_pca_float_dtype_preservation(svd_solver)
svd_solver = 'randomized'
../venv/lib/python2.7/site-packages/sklearn/decomposition/tests/test_pca.py:707: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
svd_solver = 'randomized'
    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)
        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_array_almost_equal(pca_64.components_, pca_32.components_,
>                                 decimal=5)
E       AssertionError: 
E       Arrays are not almost equal to 5 decimals
E       
E       (mismatch 16.6666666667%)
E        x: array([[ 0.62022,  0.15983, -0.38317, -0.66555],
E              [ 0.26318,  0.24085,  0.90801, -0.21966],
E              [-0.12498, -0.88109,  0.16727, -0.42437]])
E        y: array([[ 0.62022,  0.15983, -0.38317, -0.66555],
E              [ 0.26318,  0.24084,  0.90801, -0.21967],
E              [-0.12498, -0.88109,  0.16726, -0.42436]], dtype=float32)
X_32       = array([[ 0.54881352,  0.71518934,  0.60276335,  0.54488319],
       [ 0.423654...],
       [ 0.43487364,  0.83000296,  0.93280619,  0.30833843]], dtype=float32)
X_64       = array([[ 0.5488135 ,  0.71518937,  0.60276338,  0.54488318],
       [ 0.423654...91,  0.34963937],
       [ 0.43487363,  0.83000295,  0.93280618,  0.30833843]])
pca_32     = PCA(copy=True, iterated_power='auto', n_components=3, random_state=0,
  svd_solver='randomized', tol=0.0, whiten=False)
pca_64     = PCA(copy=True, iterated_power='auto', n_components=3, random_state=0,
  svd_solver='randomized', tol=0.0, whiten=False)
svd_solver = 'randomized'

I can't see any change in 0.20.2 that could have caused this new failure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions