8000 TST: fix tests on numpy 1.9.b2 by GaelVaroquaux · Pull Request #3446 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

TST: fix tests on numpy 1.9.b2 #3446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sklearn/metrics/tests/test_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,14 +867,14 @@ def check_alternative_lrap_implementation(lrap_score, n_classes=5,
y_score = y_score.toarray()
score_lrap = label_ranking_average_precision_score(y_true, y_score)
score_my_lrap = _my_lrap(y_true, y_score)
assert_equal(score_lrap, score_my_lrap)
assert_almost_equal(score_lrap, score_my_lrap)

# Uniform score
random_state = check_random_state(random_state)
y_score = random_state.uniform(size=(n_samples, n_classes))
score_lrap = label_ranking_average_precision_score(y_true, y_score)
score_my_lrap = _my_lrap(y_true, y_score)
assert_equal(score_lrap, score_my_lrap)
assert_almost_equal(score_lrap, score_my_lrap)


def test_label_ranking_avp():
Expand Down
14 changes: 6 additions & 8 deletions sklearn/metrics/tests/test_score_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from sklearn.utils.testing import assert_raises_regexp
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import ignore_warnings
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_not_equal

from sklearn.metrics import (f1_score, r2_score, roc_auc_score, fbeta_score,
Expand Down Expand Up @@ -270,13 +269,12 @@ def test_scorer_sample_weight():
ignored = scorer(estimator[name], X_test[10:], y_test[10:])
unweighted = scorer(estimator[name], X_test, y_test)
assert_not_equal(weighted, unweighted,
"scorer {0} behaves identically when called with "
"sample weights: {1} vs {2}".format(name,
weighted,
unweighted))
assert_equal(weighted, ignored,
"scorer {0} behaves differently when ignoring "
"samples and setting sample_weight to 0: "
msg="scorer {0} behaves identically when "
"called with sample weights: {1} vs "
"{2}".format(name, weighted, unweighted))
assert_almost_equal(weighted, ignored,
err_msg="scorer {0} behaves differently when "
"ignoring samples and setting sample_weight to 0: "
"{1} vs {2}".format(name, weighted, ignored))

except TypeError as e:
3A2D Expand Down
0