Skip to content

Commit 12d5f07

Browse files
staubdajnothman
authored andcommitted
[MR] Speed issues in sample_without_replacement - bugfix (scikit-learn#7104)
* Remove cdivision=True Cython compiler directive causing incorrect int division. * Decrease tol for LogisticRegression fit test, perhaps needed due to test not controlling `random_state`.
1 parent c98adf7 commit 12d5f07

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

sklearn/linear_model/tests/test_logistic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,10 @@ def test_logistic_regression_sample_weights():
630630
# since the patched liblinear code is different.
631631
clf_cw = LogisticRegression(
632632
solver="liblinear", fit_intercept=False, class_weight={0: 1, 1: 2},
633-
penalty="l1")
633+
penalty="l1", tol=1e-5)
634634
clf_cw.fit(X, y)
635635
clf_sw = LogisticRegression(
636-
solver="liblinear", fit_intercept=False, penalty="l1")
636+
solver="liblinear", fit_intercept=False, penalty="l1", tol=1e-5)
637637
clf_sw.fit(X, y, sample_weight)
638638
assert_array_almost_equal(clf_cw.coef_, clf_sw.coef_, decimal=4)
639639

sklearn/utils/_random.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# cython: cdivision=True
21
# cython: boundscheck=False
32
# cython: wraparound=False
43
#

0 commit comments

Comments
 (0)