-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Travis cron job fails #12882
Copy link
Copy link
Closed
Description
Post it here to see if someone has time.
____________________________ 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 not X_sparse_unsorted.has_sorted_indices
E AssertionError: assert not 1
E + where 1 = <50x64 sparse matrix of type '<class 'numpy.float64'>'\n with 1628 stored elements in Compressed Sparse Row format>.has_sorted_indices
X = array([[ 0., 0., 5., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 10., 0., 0.],
[ 0., 0., 0., ..., 16... 0., 0., ..., 6., 0., 0.],
[ 0., 0., 2., ..., 6., 0., 0.],
[ 0., 0., 1., ..., 8., 0., 0.]])
X_sparse = <50x64 sparse matrix of type '<class 'numpy.float64'>'
with 1628 stored elements in Compressed Sparse Row format>
X_sparse_unsorted = <50x64 sparse matrix of type '<class 'numpy.float64'>'
with 1628 stored elements in Compressed Sparse Row format>
X_test = <50x64 sparse matrix of type '<class 'numpy.float64'>'
with 1583 stored elements in Compressed Sparse Row format>
X_test_unsorted = <50x64 sparse matrix of type '<class 'numpy.float64'>'
with 1583 stored elements in Compressed Sparse Row format>
coef_dense = array([[ 0. , 0. , 0.00134814, ..., -0.002488 ,
0. , 0. ],
[ 0. ...917, -0.00045177],
[ 0. , -0.00067068, -0.0021453 , ..., -0.00229777,
-0.00393698, -0.00026964]])
coef_sorted = <45x64 sparse matrix of type '<class 'numpy.float64'>'
with 2045 stored elements in Compressed Sparse Row format>
digits = {'data': array([[ 0., 0., 5., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 10., 0., 0.],
[ 0., 0., 0....versity.\n 2005.\n - Claudio Gentile. A New Approximate Maximal Margin Classification\n Algorithm. NIPS. 2000."}
sparse_svc = SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto_deprecated',
kernel='linear', max_iter=-1, probability=True, random_state=0,
shrinking=True, tol=0.001, verbose=False)
y = array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, 0, 9, 5, 5, 6, 5, 0, 9, 8, 9, 8, 4, 1, 7,
7, 3, 5, 1, 0, 0])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels