8000 TST Sets random_state for test_logistic.py (#25446) · scikit-learn/scikit-learn@e2e7050 · GitHub
[go: up one dir, main page]

Skip to content

Commit e2e7050

Browse files
authored
TST Sets random_state for test_logistic.py (#25446)
1 parent daa8449 commit e2e7050

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sklearn/linear_model/tests/test_logistic.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
import os
33
import warnings
4+
from functools import partial
45
import numpy as np
56
from numpy.testing import assert_allclose, assert_almost_equal
67
from numpy.testing import assert_array_almost_equal, assert_array_equal
@@ -28,13 +29,16 @@
2829
from sklearn.linear_model._logistic import (
2930
_log_reg_scoring_path,
3031
_logistic_regression_path,
31-
LogisticRegression,
32-
LogisticRegressionCV,
32+
LogisticRegression as LogisticRegressionDefault,
33+
LogisticRegressionCV as LogisticRegressionCVDefault,
3334
)
3435

3536
pytestmark = pytest.mark.filterwarnings(
3637
"error::sklearn.exceptions.ConvergenceWarning:sklearn.*"
3738
)
39+
# Fixing random_state helps prevent ConvergenceWarnings
40+
LogisticRegression = partial(LogisticRegressionDefault, random_state=0)
41+
LogisticRegressionCV = partial(LogisticRegressionCVDefault, random_state=0)
3842

3943

4044
SOLVERS = ("lbfgs", "liblinear", "newton-cg", "newton-cholesky", "sag", "saga")

0 commit comments

Comments
 (0)
0