From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: bug#37433: python-scikit-learn has two failing tests Date: Tue, 17 Sep 2019 00:46:01 +0200 Message-ID: <87ftkvq2qe.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:45342) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9zlv-0003ko-RV for bug-guix@gnu.org; Mon, 16 Sep 2019 18:47:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9zlu-000766-I9 for bug-guix@gnu.org; Mon, 16 Sep 2019 18:47:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9zlu-00075z-F6 for bug-guix@gnu.org; Mon, 16 Sep 2019 18:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i9zlu-0003kb-Dd for bug-guix@gnu.org; Mon, 16 Sep 2019 18:47:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:45290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9zlG-0003hk-4h for bug-guix@gnu.org; Mon, 16 Sep 2019 18:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9zlE-0006qu-Nz for bug-guix@gnu.org; Mon, 16 Sep 2019 18:46:21 -0400 Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9zlB-0006pO-9S for bug-guix@gnu.org; Mon, 16 Sep 2019 18:46:19 -0400 List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 37433@debbugs.gnu.org Cc: "Lindberg, Eric Lars-Helge" The python-scikit-learn package fails to build due to two failing tests: --8<---------------cut here---------------start------------->8--- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D FAILURES =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ___________________________ test_scale_and_stability ______________________= _____ def test_scale_and_stability(): # We test scale=3DTrue parameter # This allows to check numerical stability over platforms as well =20=20=20=20 d =3D load_linnerud() X1 =3D d.data Y1 =3D d.target # causes X[:, -1].std() to be zero X1[:, -1] =3D 1.0 =20=20=20=20 # From bug #2821 # Test with X2, T2 s.t. clf.x_score[:, 1] =3D=3D 0, clf.y_score[:, = 1] =3D=3D 0 # This test robustness of algorithm when dealing with value close t= o 0 X2 =3D np.array([[0., 0., 1.], [1., 0., 0.], [2., 2., 2.], [3., 5., 4.]]) Y2 =3D np.array([[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]]) =20=20=20=20 for (X, Y) in [(X1, Y1), (X2, Y2)]: X_std =3D X.std(axis=3D0, ddof=3D1) X_std[X_std =3D=3D 0] =3D 1 Y_std =3D Y.std(axis=3D0, ddof=3D1) Y_std[Y_std =3D=3D 0] =3D 1 =20=20=20=20 X_s =3D (X - X.mean(axis=3D0)) / X_std Y_s =3D (Y - Y.mean(axis=3D0)) / Y_std =20=20=20=20 for clf in [CCA(), pls_.PLSCanonical(), pls_.PLSRegression(), pls_.PLSSVD()]: clf.set_params(scale=3DTrue) X_score, Y_score =3D clf.fit_transform(X, Y) clf.set_params(scale=3DFalse) X_s_score, Y_s_score =3D clf.fit_transform(X_s, Y_s) assert_array_almost_equal(X_s_score, X_score) assert_array_almost_equal(Y_s_score, Y_score) # Scaling should be idempotent clf.set_params(scale=3DTrue) X_score, Y_score =3D clf.fit_transform(X_s, Y_s) > assert_array_almost_equal(X_s_score, X_score) E AssertionError:=20 E Arrays are not almost equal to 6 decimals E=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 E (mismatch 50.0%) E x: array([-1.337317, -0.041705, -1.108472, 0.098154, 0.4= 07632, -0.103084, E 2.038158, 0.046634]) E y: array([-1.337317, -0.041776, -1.108472, 0.0982 , 0.4= 07632, -0.103027, E 2.038158, 0.046602]) sklearn/cross_decomposition/tests/test_pls.py:365: AssertionError ____________________________ test_unsorted_indices ________________________= _____ def test_unsorted_indices(): # test that the result with sorted and unsorted indices in csr is t= he same # we use a subset of digits as iris, blobs or make_classification d= idn't # show the problem digits =3D load_digits() X, y =3D digits.data[:50], digits.target[:50] X_test =3D sparse.csr_matrix(digits.data[50:100]) =20=20=20=20 X_sparse =3D sparse.csr_matrix(X) coef_dense =3D svm.SVC(kernel=3D'linear', probability=3DTrue, random_state=3D0).fit(X, y).coef_ sparse_svc =3D svm.SVC(kernel=3D'linear', probability=3DTrue, random_state=3D0).fit(X_sparse, y) coef_sorted =3D sparse_svc.coef_ # make sure dense and sparse SVM give the same result assert_array_almost_equal(coef_dense, coef_sorted.toarray()) =20=20=20=20 X_sparse_unsorted =3D X_sparse[np.arange(X.shape[0])] X_test_unsorted =3D X_test[np.arange(X_test.shape[0])] =20=20=20=20 # make sure we scramble the indices > assert_false(X_sparse_unsorted.has_sorted_indices) sklearn/svm/tests/test_sparse.py:118:=20 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _= _ _=20 self =3D ,= expr =3D 1 msg =3D '1 is not false' def assertFalse(self, expr, msg=3DNone): """Check that the expression is false.""" if expr: msg =3D self._formatMessage(msg, "%s is not false" % safe_repr(= expr)) > raise self.failureException(msg) E AssertionError: 1 is not false /gnu/store/b7fqhszxl02g6pfm3vw6b3cjz472qrly-python-3.7.0/lib/python3.7/unit= test/case.py:686: AssertionError [=E2=80=A6] 2 failed, 10415 passed, 30 skipped, 1 deselected, 1 xfailed, 1026 warnings = in 895.50 seconds=20 --8<---------------cut here---------------end--------------->8--- --=20 Ricardo