Skip to content

[ppc64el/0.20.0] test_logistic_regression_multi_class_auto[lbfgs-est1] failure #12448

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

Closed
cdluminate opened this issue Oct 24, 2018 · 9 comments
Closed

Comments

@cdluminate
Copy link

____________ test_logistic_regression_multi_class_auto[lbfgs-est1] _____________

est = LogisticRegressionCV(Cs=10, class_weight=None, cv=3, dual=False,
           fi...=0,
           refit=True, scoring=None, solver='lbfgs', tol=0.0001, verbose=0)
solver = 'lbfgs'

    @pytest.mark.parametrize('est', [LogisticRegression(random_state=0),
                                     LogisticRegressionCV(random_state=0, cv=3),
                                     ])
    @pytest.mark.parametrize('solver', ['liblinear', 'lbfgs', 'newton-cg', 'sag',
                                        'saga'])
    def test_logistic_regression_multi_class_auto(est, solver):
        # check multi_class='auto' => multi_class='ovr' iff binary y or liblinear
    
        def fit(X, y, **kw):
            return clone(est).set_params(**kw).fit(X, y)
    
        X = iris.data[::10]
        X2 = iris.data[1::10]
        y_multi = iris.target[::10]
        y_bin = y_multi == 0
        est_auto_bin = fit(X, y_bin, multi_class='auto', solver=solver)
        est_ovr_bin = fit(X, y_bin, multi_class='ovr', solver=solver)
        assert np.allclose(est_auto_bin.coef_, est_ovr_bin.coef_)
        assert np.allclose(est_auto_bin.predict_proba(X2),
                           est_ovr_bin.predict_proba(X2))
    
        est_auto_multi = fit(X, y_multi, multi_class='auto', solver=solver)
        if solver == 'liblinear':
            est_ovr_multi = fit(X, y_multi, multi_class='ovr', solver=solver)
            assert np.allclose(est_auto_multi.coef_, est_ovr_multi.coef_)
            assert np.allclose(est_auto_multi.predict_proba(X2),
                               est_ovr_multi.predict_proba(X2))
        else:
            est_multi_multi = fit(X, y_multi, multi_class='multinomial',
                                  solver=solver)
            if sys.platform == 'darwin' and solver == 'lbfgs':
                pytest.xfail('Issue #11924: LogisticRegressionCV(solver="lbfgs", '
                             'multi_class="multinomial") is nondterministic on '
                             'MacOS.')  # pragma: no cover
>           assert np.allclose(est_auto_multi.coef_, est_multi_multi.coef_)
E           AssertionError: assert False
E            +  where False = <function allclose at 0x3fff90b8a050>(array([[-1.9311303 ,  2.82716291, -9.14686378, -4.03266391],\n       [-2.863746...15, -7.47563299],\n       [ 4.79487692,  0.07942529, 10.62611993, 11.5082969 ]]), array([[-1.80929916,  2.83798098, -9.17700613, -4.04065419],\n       [-2.952913...61, -7.52719256],\n       [ 4.76221304,  0.11442281, 10.58513974, 11.56784676]]))
E            +    where <function allclose at 0x3fff90b8a050> = np.allclose
E            +    and   array([[-1.9311303 ,  2.82716291, -9.14686378, -4.03266391],\n       [-2.863746...15, -7.47563299],\n       [ 4.79487692,  0.07942529, 10.62611993, 11.5082969 ]]) = LogisticRegressionCV(Cs=10, class_weight=None, cv=3, dual=False,\n           fi...=0,\n           refit=True, scoring=None, solver='lbfgs', tol=0.0001, verbose=0).coef_
E            +    and   array([[-1.80929916,  2.83798098, -9.17700613, -4.04065419],\n       [-2.952913...61, -7.52719256],\n       [ 4.76221304,  0.11442281, 10.58513974, 11.56784676]]) = LogisticRegressionCV(Cs=10, class_weight=None, cv=3, dual=False,\n           fi...=0, refit=True, scoring=None, solver='lbfgs',\n           tol=0.0001, verbose=0).coef_

sklearn/linear_model/tests/test_logistic.py:1436: AssertionError
 test_non_meta_estimators[LocallyLinearEmbedding-LocallyLinearEmbedding-check_pipeline_consistency] 

name = 'LocallyLinearEmbedding'
Estimator = <class 'sklearn.manifold.locally_linear.LocallyLinearEmbedding'>
check = <function check_pipeline_consistency at 0x3fff89bda938>

    @pytest.mark.parametrize(
            "name, Estimator, check",
            _generate_checks_per_estimator(_yield_all_checks,
                                           _tested_non_meta_estimators()),
            ids=_rename_partial
    )
    def test_non_meta_estimators(name, Estimator, check):
        # Common tests for non-meta estimators
        with ignore_warnings(category=(DeprecationWarning, ConvergenceWarning,
                                       UserWarning, FutureWarning)):
            estimator = Estimator()
            set_checking_parameters(estimator)
>           check(name, estimator)

sklearn/tests/test_common.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sklearn/utils/testing.py:350: in wrapper
    return fn(*args, **kwargs)
sklearn/utils/estimator_checks.py:1047: in check_pipeline_consistency
    assert_allclose_dense_sparse(result, result_pipe)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = array([[-4.09281340e-02,  2.82586226e-01],
       [-2.54934412e-01,  1.5124485...[-4.09281341e-02, -1.78058052e-01],
       [-2.54934412e-01,  2.87156151e-11]])
y = array([[ 2.34354668e-01,  2.82586226e-01],
       [ 1.08372304e-01,  1.0799944...[ 2.34354668e-01, -1.78058052e-01],
       [ 1.08372304e-01,  1.47967914e-11]])
rtol = 1e-07, atol = 1e-09, err_msg = ''

    def assert_allclose_dense_sparse(x, y, rtol=1e-07, atol=1e-9, err_msg=''):
        """Assert allclose for sparse and dense data.
    
        Both x and y need to be either sparse or dense, they
        can't be mixed.
    
        Parameters
        ----------
        x : array-like or sparse matrix
            First array to compare.
    
        y : array-like or sparse matrix
            Second array to compare.
    
        rtol : float, optional
            relative tolerance; see numpy.allclose
    
        atol : float, optional
            absolute tolerance; see numpy.allclose. Note that the default here is
            more tolerant than the default for numpy.testing.assert_allclose, where
            atol=0.
    
        err_msg : string, default=''
            Error message to raise.
        """
        if sp.sparse.issparse(x) and sp.sparse.issparse(y):
            x = x.tocsr()
            y = y.tocsr()
            x.sum_duplicates()
            y.sum_duplicates()
            assert_array_equal(x.indices, y.indices, err_msg=err_msg)
            assert_array_equal(x.indptr, y.indptr, err_msg=err_msg)
            assert_allclose(x.data, y.data, rtol=rtol, atol=atol, err_msg=err_msg)
        elif not sp.sparse.issparse(x) and not sp.sparse.issparse(y):
            # both dense
>           assert_allclose(x, y, rtol=rtol, atol=atol, err_msg=err_msg)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=1e-09
E           
E           (mismatch 50.0%)
E            x: array([[-4.092813e-02,  2.825862e-01],
E                  [-2.549344e-01,  1.512448e-11],
E                  [-2.549344e-01,  2.129832e-11],...
E            y: array([[ 2.343547e-01,  2.825862e-01],
E                  [ 1.083723e-01,  1.079994e-11],
E                  [ 1.083723e-01,  1.725964e-11],...

sklearn/utils/testing.py:464: AssertionError
@rth
Copy link
Member

rth commented Oct 24, 2018

Thanks for the report. That's on debian? Please provide the output of sklearn.show_versions() http://scikit-learn.org/stable/developers/contributing.html#how-to-make-a-good-bug-report

Someone should try to reproduce in Docker using e.g. https://github.com/rth/scikit-learn-dev-docker/blob/master/debian/apt/Dockerfile setup possibly with the ppc64le/debian:testing ppc64le/debian:sid image.

@cdluminate
Copy link
Author

I'm trying to diagnose build issues for Debian pacakge. https://buildd.debian.org/status/package.php?p=scikit-learn

I'll try to get the show_versions() result later.

@rth rth added this to the 0.20.1 milestone Oct 24, 2018
@amueller
Copy link
Member

Any update on this?

@amueller
Copy link
Member

There's a weird issue on debian with the fetch_openml tests:
https://buildd.debian.org/status/fetch.php?pkg=scikit-learn&arch=ppc64&ver=0.20.0%2Bdfsg-2&stamp=1541700243&raw=0 is that tracked somewhere?

@rth
Copy link
Member

rth commented Nov 12, 2018

No, also you can't reproduce it in Docker, need a ppc64le VM, personally, I won't be able to work on it this week.

There's a weird issue on debian with the fetch_openml tests:
https://buildd.debian.org/status/fetch.php?pkg=scikit-learn&arch=ppc64&ver=0.20.0%2Bdfsg-2&stamp=1541700243&raw=0

Is that the right link? Can't see anything matching fetch_openml there..

@amueller amueller modified the milestones: 0.20.1, 0.21 Nov 20, 2018
@amueller
Copy link
Member

retagging see #12548 (comment)

@cdluminate
Copy link
Author

cdluminate commented Dec 26, 2018

Thanks for the report. That's on debian? Please provide the output of sklearn.show_versions()

System:                                                                                                                                                                      
    python: 3.7.2rc1 (default, Dec 12 2018, 06:25:49)  [GCC 8.2.0]                                                                                                           
executable: /usr/bin/python3.7                                                                                                                                               
   machine: Linux-4.9.0-8-powerpc64le-ppc64le-with-debian-buster-sid                                                                                                         
                                                                                                                                                                             
BLAS:                                                                                                                                                                        
    macros: HAVE_CBLAS=None, NO_ATLAS_INFO=-1                                                                                                                                
  lib_dirs: /usr/lib/powerpc64le-linux-gnu                                                                                                                                   
cblas_libs: cblas                                                                                                                                                            
                                                                                                                                                                             
Python deps:                                                                                                                                                                 
       pip: None                                                                                                                                                             
setuptools: 40.6.2                                                                                                                                                           
   sklearn: 0.20.1                                                                                                                                                           
     numpy: 1.16.0rc1                                                                                                                                                        
     scipy: 1.1.0                                                                                                                                                            
    Cython: 0.28.4                                                                                                                                                           
    pandas: 0.23.3

@rth
Copy link
Member

rth commented Feb 28, 2019

The issue with LocallyLinearEmbedding was addressed in #13323 (by skipping that test on PowerPC and 32 bit arch) and the test_logistic_regression_multi_class_auto was not reproduced in on the same Debian build system for the later 0.20.1 releases I think (see #13036).

Closing. Please comment or re-open if it's still an issue.

@rth rth closed this as completed Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants