8000 TST: fix tests on numpy 1.9.b2 · scikit-learn/scikit-learn@41d02e0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41d02e0

Browse files
GaelVaroquauxogrisel
authored andcommitted
TST: fix tests on numpy 1.9.b2
1 parent 8f68e54 commit 41d02e0

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

sklearn/metrics/tests/test_ranking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,14 +867,14 @@ def check_alternative_lrap_implementation(lrap_score, n_classes=5,
867867
y_score = y_score.toarray()
868868
score_lrap = label_ranking_average_precision_score(y_true, y_score)
869869
score_my_lrap = _my_lrap(y_true, y_score)
870-
assert_equal(score_lrap, score_my_lrap)
870+
assert_almost_equal(score_lrap, score_my_lrap)
871871

872872
# Uniform score
873873
random_state = check_random_state(random_state)
874874
y_score = random_state.uniform(size=(n_samples, n_classes))
875875
score_lrap = label_ranking_average_precision_score(y_true, y_score)
876876
score_my_lrap = _my_lrap(y_true, y_score)
877-
assert_equal(score_lrap, score_my_lrap)
877+
assert_almost_equal(score_lrap, score_my_lrap)
878878

879879

880880
def test_label_ranking_avp():

sklearn/metrics/tests/test_score_objects.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from sklearn.utils.testing import assert_raises_regexp
88
from sklearn.utils.testing import assert_true
99
from sklearn.utils.testing import ignore_warnings
10-
from sklearn.utils.testing import assert_equal
1110
from sklearn.utils.testing import assert_not_equal
1211

1312
from sklearn.metrics import (f1_score, r2_score, roc_auc_score, fbeta_score,
@@ -270,13 +269,12 @@ def test_scorer_sample_weight():
270269
ignored = scorer(estimator[name], X_test[10:], y_test[10:])
271270
unweighted = scorer(estimator[name], X_test, y_test)
272271
assert_not_equal(weighted, unweighted,
273-
"scorer {0} behaves identically when called with "
274-
"sample weights: {1} vs {2}".format(name,
275-
weighted,
276-
unweighted))
277-
assert_equal(weighted, ignored,
278-
"scorer {0} behaves differently when ignoring "
279-
"samples and setting sample_weight to 0: "
272+
msg="scorer {0} behaves identically when "
273+
"called with sample weights: {1} vs "
274+
"{2}".format(name, weighted, unweighted))
275+
assert_almost_equal(weighted, ignored,
276+
err_msg="scorer {0} behaves differently when "
277+
"ignoring samples and setting sample_weight to 0: "
280278
"{1} vs {2}".format(name, weighted, ignored))
281279

282280
except TypeError as e:

0 commit comments

Comments
 (0)
0