Skip to content

Commit 9e1377a

Browse files
committed
FIX revert wrong previous fix and make weighted scorer test deterministic
1 parent c23d4f3 commit 9e1377a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklearn/metrics/tests/test_score_objects.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ def test_scorer_sample_weight():
316316
# get sensible estimators for each metric
317317
sensible_regr = DummyRegressor(strategy='median')
318318
sensible_regr.fit(X_train, y_train)
319-
sensible_clf = DecisionTreeClassifier()
319+
sensible_clf = DecisionTreeClassifier(random_state=0)
320320
sensible_clf.fit(X_train, y_train)
321-
sensible_ml_clf = DecisionTreeClassifier()
321+
sensible_ml_clf = DecisionTreeClassifier(random_state=0)
322322
sensible_ml_clf.fit(X_train, y_ml_train)
323323
estimator = dict([(name, sensible_regr)
324324
for name in REGRESSION_SCORERS] +
@@ -341,7 +341,7 @@ def test_scorer_sample_weight():
341341
msg="scorer {0} behaves identically when "
342342
"called with sample weights: {1} vs "
343343
"{2}".format(name, weighted, unweighted))
344-
assert_almost_equal(weighted, ignored, decimal=5,
344+
assert_almost_equal(weighted, ignored,
345345
err_msg="scorer {0} behaves differently when "
346346
"ignoring samples and setting sample_weight to"
347347
" 0: {1} vs {2}".format(name, weighted,

0 commit comments

Comments
 (0)