From 2ca6542ef89d0dca17dec25fd39fb4eead1cd829 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Tue, 21 Aug 2018 11:33:07 -0400 Subject: [PATCH 1/3] use almost equal on decision function --- sklearn/utils/estimator_checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/utils/estimator_checks.py b/sklearn/utils/estimator_checks.py index dac884a317bc3..590529e3eed73 100644 --- a/sklearn/utils/estimator_checks.py +++ b/sklearn/utils/estimator_checks.py @@ -1545,7 +1545,7 @@ def check_outliers_train(name, estimator_orig, readonly_memmap=True): y_scores = estimator.score_samples(X) assert y_scores.shape == (n_samples,) y_dec = y_scores - estimator.offset_ - assert_array_equal(y_dec, decision) + assert_array_almost_equal(y_dec, decision) # raises error on malformed input for score_samples assert_raises(ValueError, estimator.score_samples, X.T) From 6f7975fc55c5c7eae98c2af14b3eaa95dbb6c7a8 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Tue, 21 Aug 2018 12:01:51 -0400 Subject: [PATCH 2/3] gone for too long lol. using assert_allclose --- sklearn/utils/estimator_checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/utils/estimator_checks.py b/sklearn/utils/estimator_checks.py index 590529e3eed73..8cb893c495a23 100644 --- a/sklearn/utils/estimator_checks.py +++ b/sklearn/utils/estimator_checks.py @@ -1545,7 +1545,7 @@ def check_outliers_train(name, estimator_orig, readonly_memmap=True): y_scores = estimator.score_samples(X) assert y_scores.shape == (n_samples,) y_dec = y_scores - estimator.offset_ - assert_array_almost_equal(y_dec, decision) + assert_allclose(y_dec, decision) # raises error on malformed input for score_samples assert_raises(ValueError, estimator.score_samples, X.T) From 4c853d7060a85f31d220dcd530253b1d40489843 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Tue, 21 Aug 2018 13:22:42 -0400 Subject: [PATCH 3/3] skip some unstable SVM tests on 32bits --- sklearn/svm/tests/test_sparse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sklearn/svm/tests/test_sparse.py b/sklearn/svm/tests/test_sparse.py index 5fa83050a98f1..25cff0eb7468a 100644 --- a/sklearn/svm/tests/test_sparse.py +++ b/sklearn/svm/tests/test_sparse.py @@ -10,7 +10,7 @@ from sklearn.utils.extmath import safe_sparse_dot from sklearn.utils.testing import (assert_raises, assert_true, assert_false, assert_warns, assert_raise_message, - ignore_warnings) + ignore_warnings, skip_if_32bit) # test sample 1 X = np.array([[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]]) @@ -71,6 +71,7 @@ def check_svm_model_equal(dense_svm, sparse_svm, X_train, y_train, X_test): assert_raise_message(ValueError, msg, dense_svm.predict, X_test) +@skip_if_32bit def test_svc(): """Check that sparse SVC gives the same result as SVC""" # many class dataset: @@ -265,6 +266,7 @@ def test_sparse_liblinear_intercept_handling(): test_svm.test_dense_liblinear_intercept_handling(svm.LinearSVC) +@skip_if_32bit def test_sparse_oneclasssvm(): # Check that sparse OneClassSVM gives the same result as dense OneClassSVM # many class dataset: