Skip to content

TST Sets random_state for test_logistic.py #25446

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

Merged
merged 1 commit into from
Jan 25, 2023
Merged
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
8 changes: 6 additions & 2 deletions sklearn/linear_model/tests/test_logistic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import itertools
import os
import warnings
from functools import partial
import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
from numpy.testing import assert_array_almost_equal, assert_array_equal
Expand Down Expand Up @@ -28,13 +29,16 @@
from sklearn.linear_model._logistic import (
_log_reg_scoring_path,
_logistic_regression_path,
LogisticRegression,
LogisticRegressionCV,
LogisticRegression as LogisticRegressionDefault,
LogisticRegressionCV as LogisticRegressionCVDefault,
)

pytestmark = pytest.mark.filterwarnings(
"error::sklearn.exceptions.ConvergenceWarning:sklearn.*"
)
# Fixing random_state helps prevent ConvergenceWarnings
LogisticRegression = partial(LogisticRegressionDefault, random_state=0)
LogisticRegressionCV = partial(LogisticRegressionCVDefault, random_state=0)


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