Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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:
Expand Down