Bug#933366: scikit-learn: Please upgrade to 0.21.0 or later

2020-01-08 Thread Sandro Tosi
Package: src:scikit-learn
Followup-For: Bug #933366

Hello,
i was trying to rebuild 0.20.3+dfsg-0.1 to disable the python2 autopkgtests but
now that version FTBFS; i believe it's becaues it's rather old (March 2019) and
a lot of other packages have been upgraded recently (namely scipy and numpy,
probably more anyway).

so i'm gonna start working on packaging 0.22.1 which has just been released,
hopefully i'll complete this work soon.

FTR the failure is:

```
=== FAILURES ===
___ test_scale_and_stability ___

def test_scale_and_stability():
# We test scale=True parameter
# This allows to check numerical stability over platforms as well

d = load_linnerud()
X1 = d.data
Y1 = d.target
# causes X[:, -1].std() to be zero
X1[:, -1] = 1.0

# From bug #2821
# Test with X2, T2 s.t. clf.x_score[:, 1] == 0, clf.y_score[:, 1] == 0
# This test robustness of algorithm when dealing with value close to 0
X2 = np.array([[0., 0., 1.],
   [1., 0., 0.],
   [2., 2., 2.],
   [3., 5., 4.]])
Y2 = np.array([[0.1, -0.2],
   [0.9, 1.1],
   [6.2, 5.9],
   [11.9, 12.3]])

for (X, Y) in [(X1, Y1), (X2, Y2)]:
X_std = X.std(axis=0, ddof=1)
X_std[X_std == 0] = 1
Y_std = Y.std(axis=0, ddof=1)
Y_std[Y_std == 0] = 1

X_s = (X - X.mean(axis=0)) / X_std
Y_s = (Y - Y.mean(axis=0)) / Y_std

for clf in [CCA(), pls_.PLSCanonical(), pls_.PLSRegression(),
pls_.PLSSVD()]:
clf.set_params(scale=True)
X_score, Y_score = clf.fit_transform(X, Y)
clf.set_params(scale=False)
X_s_score, Y_s_score = clf.fit_transform(X_s, Y_s)
>   assert_array_almost_equal(X_s_score, X_score)
E   AssertionError: 
E   Arrays are not almost equal to 6 decimals
E   
E   Mismatch: 50%
E   Max absolute difference: 5.15227746e-06
E   Max relative difference: 0.00011717
Ex: array([[-1.337317, -0.041709],
E  [-1.108472,  0.098156],
E  [ 0.407632, -0.10308 ],
E  [ 2.038158,  0.046633]])
Ey: array([[-1.337317, -0.041713],
E  [-1.108472,  0.098159],
E  [ 0.407632, -0.103075],
E  [ 2.038158,  0.04663 ]])

sklearn/cross_decomposition/tests/test_pls.py:360: AssertionError
 test_unsorted_indices _

def test_unsorted_indices():
# test that the result with sorted and unsorted indices in csr is the 
same
# we use a subset of digits as iris, blobs or make_classification didn't
# show the problem
digits = load_digits()
X, y = digits.data[:50], digits.target[:50]
X_test = sparse.csr_matrix(digits.data[50:100])

X_sparse = sparse.csr_matrix(X)
coef_dense = svm.SVC(kernel='linear', probability=True,
 random_state=0).fit(X, y).coef_
sparse_svc = svm.SVC(kernel='linear', probability=True,
 random_state=0).fit(X_sparse, y)
coef_sorted = sparse_svc.coef_
# make sure dense and sparse SVM give the same result
assert_array_almost_equal(coef_dense, coef_sorted.toarray())

X_sparse_unsorted = X_sparse[np.arange(X.shape[0])]
X_test_unsorted = X_test[np.arange(X_test.shape[0])]

# make sure we scramble the indices
>   assert_false(X_sparse_unsorted.has_sorted_indices)

sklearn/svm/tests/test_sparse.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = , expr = 1
msg = '1 is not false'

def assertFalse(self, expr, msg=None):
"""Check that the expression is false."""
if expr:
msg = self._formatMessage(msg, "%s is not false" % safe_repr(expr))
>   raise self.failureException(msg)
E   AssertionError: 1 is not false

/usr/lib/python3.8/unittest/case.py:759: AssertionError
=== short test summary info 
SKIPPED [1] /usr/lib/python3/dist-packages/_pytest/nose.py:32: This test is 
failing on the buildbot, but cannot reproduce. Temporarily disabling it until 
it can be reproduced and  fixed.
SKIPPED [3] /usr/lib/python3/dist-packages/_pytest/nose.py:32: Download 20 
newsgroups to run this test
SKIPPED [1] /usr/lib/python3/dist-packages/_pytest/nose.py:32: California 
housing dataset can not be loaded.
SKIPPED [1] /usr/lib/python3/dist-packages/_pytest/nose.py:32: Covertype 

Bug#933366: scikit-learn: Please upgrade to 0.21.0 or later

2019-07-29 Thread Bas Couwenberg
Source: scikit-learn
Version: 0.20.2+dfsg-6
Severity: normal

Dear Maintainer,

Please update the package to 0.21.0 or later which introduces
haversine_distances in sklearn/metrics/pairwise.py which is required for
PySAL 2.1.0.

Kind Regards,

Bas