Skip to content

Commit bb7e34a

Browse files
committed
MAINT avoid warning deprecation sklearn 1.5 (#1084)
1 parent 482ced9 commit bb7e34a

File tree

6 files changed

+8
-14
lines changed

6 files changed

+8
-14
lines changed

doc/under_sampling.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,7 @@ The class can be used as::
497497
>>> from sklearn.linear_model import LogisticRegression
498498
>>> from imblearn.under_sampling import InstanceHardnessThreshold
499499
>>> iht = InstanceHardnessThreshold(random_state=0,
500-
... estimator=LogisticRegression(
501-
... solver='lbfgs', multi_class='auto'))
500+
... estimator=LogisticRegression())
502501
>>> X_resampled, y_resampled = iht.fit_resample(X, y)
503502
>>> print(sorted(Counter(y_resampled).items()))
504503
[(0, 64), (1, 64), (2, 64)]

doc/whats_new/v0.12.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Compatibility
1212
.............
1313

1414
- Compatibility with scikit-learn 1.5
15-
:pr:`1074` by :user:`Guillaume Lemaitre <glemaitre>`.
15+
:pr:`1074` and :pr:`1084` by :user:`Guillaume Lemaitre <glemaitre>`.
1616

1717
Version 0.12.2
1818
==============

examples/applications/plot_outlier_rejections.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ def outlier_rejection(X, y):
109109

110110
pipe = make_pipeline(
111111
FunctionSampler(func=outlier_rejection),
112-
LogisticRegression(solver="lbfgs", multi_class="auto", random_state=rng),
112+
LogisticRegression(random_state=rng),
113113
)
114114
y_pred = pipe.fit(X_train, y_train).predict(X_test)
115115
print(classification_report(y_test, y_pred))
116116

117-
clf = LogisticRegression(solver="lbfgs", multi_class="auto", random_state=rng)
117+
clf = LogisticRegression(random_state=rng)
118118
y_pred = clf.fit(X_train, y_train).predict(X_test)
119119
print(classification_report(y_test, y_pred))
120120

imblearn/ensemble/tests/test_bagging.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def test_probability():
174174

175175
# Degenerate case, where some classes are missing
176176
ensemble = BalancedBaggingClassifier(
177-
estimator=LogisticRegression(solver="lbfgs", multi_class="auto"),
177+
estimator=LogisticRegression(solver="lbfgs"),
178178
random_state=0,
179179
max_samples=5,
180180
)
@@ -435,7 +435,7 @@ def test_estimators_samples():
435435
# remap the y outside of the BalancedBaggingclassifier
436436
# _, y = np.unique(y, return_inverse=True)
437437
bagging = BalancedBaggingClassifier(
438-
LogisticRegression(solver="lbfgs", multi_class="auto"),
438+
LogisticRegression(),
439439
max_samples=0.5,
440440
max_features=0.5,
441441
random_state=1,

imblearn/tests/test_docstring_parameters.py

-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import pytest
1212
from sklearn.datasets import make_classification
1313
from sklearn.linear_model import LogisticRegression
14-
from sklearn.utils import IS_PYPY
1514
from sklearn.utils._testing import (
1615
_get_func_name,
1716
check_docstring_parameters,
@@ -70,7 +69,6 @@
7069
# Python 3.7
7170
@pytest.mark.filterwarnings("ignore::FutureWarning")
7271
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
73-
@pytest.mark.skipif(IS_PYPY, reason="test segfaults on PyPy")
7472
def test_docstring_parameters():
7573
# Test module docstring formatting
7674

@@ -154,9 +152,6 @@ def test_tabs():
154152
for importer, modname, ispkg in walk_packages(
155153
imblearn.__path__, prefix="imblearn."
156154
):
157-
if IS_PYPY:
158-
continue
159-
160155
# because we don't import
161156
mod = importlib.import_module(modname)
162157

imblearn/tests/test_pipeline.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def test_pipeline_methods_anova():
272272
X = iris.data
273273
y = iris.target
274274
# Test with Anova + LogisticRegression
275-
clf = LogisticRegression(solver="lbfgs", multi_class="auto")
275+
clf = LogisticRegression()
276276
filter1 = SelectKBest(f_classif, k=2)
277277
pipe = Pipeline([("anova", filter1), ("logistic", clf)])
278278
pipe.fit(X, y)
@@ -639,7 +639,7 @@ def test_classes_property():
639639

640640
clf = make_pipeline(
641641
SelectKBest(k=1),
642-
LogisticRegression(solver="lbfgs", multi_class="auto", random_state=0),
642+
LogisticRegression(),
643643
)
644644
with raises(AttributeError):
645645
getattr(clf, "classes_")

0 commit comments

Comments
 (0)