8000 MAINT avoid warning deprecation sklearn 1.5 by glemaitre · Pull Request #1084 · scikit-learn-contrib/imbalanced-learn · GitHub
[go: up one dir, main page]

Skip to content

MAINT avoid warning deprecation sklearn 1.5 #1084

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
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions doc/under_sampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,7 @@ The class can be used as::
>>> from sklearn.linear_model import LogisticRegression
>>> from imblearn.under_sampling import InstanceHardnessThreshold
>>> iht = InstanceHardnessThreshold(random_state=0,
... estimator=LogisticRegression(
... solver='lbfgs', multi_class='auto'))
... estimator=LogisticRegression())
>>> X_resampled, y_resampled = iht.fit_resample(X, y)
>>> print(sorted(Counter(y_resampled).items()))
[(0, 64), (1, 64), (2, 64)]
2 changes: 1 addition & 1 deletion doc/whats_new/v0.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Compatibility
.............

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

Version 0.12.2
==============
Expand Down
4 changes: 2 additions & 2 deletions examples/applications/plot_outlier_rejections.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ def outlier_rejection(X, y):

pipe = make_pipeline(
FunctionSampler(func=outlier_rejection),
LogisticRegression(solver="lbfgs", multi_class="auto", random_state=rng),
LogisticRegression(random_state=rng),
)
y_pred = pipe.fit(X_train, y_train).predict(X_test)
print(classification_report(y_test, y_pred))

clf = LogisticRegression(solver="lbfgs", multi_class="auto", random_state=rng)
clf = LogisticRegression(random_state=rng)
y_pred = clf.fit(X_train, y_train).predict(X_test)
print(classification_report(y_test, y_pred))

Expand Down
4 changes: 2 additions & 2 deletions imblearn/ensemble/tests/test_bagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_probability():

# Degenerate case, where some classes are missing
ensemble = BalancedBaggingClassifier(
estimator=LogisticRegression(solver="lbfgs", multi_class="auto"),
estimator=LogisticRegression(solver="lbfgs"),
random_state=0,
max_samples=5,
)
Expand Down Expand Up @@ -435,7 +435,7 @@ def test_estimators_samples():
# remap the y outside of the BalancedBaggingclassifier
# _, y = np.unique(y, return_inverse=True)
bagging = BalancedBaggingClassifier(
LogisticRegression(solver="lbfgs", multi_class="auto"),
LogisticRegression(),
max_samples=0.5,
max_features=0.5,
random_state=1,
Expand Down
5 changes: 0 additions & 5 deletions imblearn/tests/test_docstring_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import pytest
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.utils import IS_PYPY
from sklearn.utils._testing import (
_get_func_name,
check_docstring_parameters,
Expand Down Expand Up @@ -70,7 +69,6 @@
# Python 3.7
@pytest.mark.filterwarnings("ignore::FutureWarning")
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
@pytest.mark.skipif(IS_PYPY, reason="test segfaults on PyPy")
def test_docstring_parameters():
# Test module docstring formatting

Expand Down Expand Up @@ -154,9 +152,6 @@ def test_tabs():
for importer, modname, ispkg in walk_packages(
imblearn.__path__, prefix="imblearn."
):
if IS_PYPY:
continue

# because we don't import
mod = importlib.import_module(modname)

Expand Down
4 changes: 2 additions & 2 deletions imblearn/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def test_pipeline_methods_anova():
X = iris.data
y = iris.target
# Test with Anova + LogisticRegression
clf = LogisticRegression(solver="lbfgs", multi_class="auto")
clf = LogisticRegression()
filter1 = SelectKBest(f_classif, k=2)
pipe = Pipeline([("anova", filter1), ("logistic", clf)])
pipe.fit(X, y)
Expand Down Expand Up @@ -639,7 +639,7 @@ def test_classes_property():

clf = make_pipeline(
SelectKBest(k=1),
LogisticRegression(solver="lbfgs", multi_class="auto", random_state=0),
LogisticRegression(),
)
with raises(AttributeError):
getattr(clf, "classes_")
Expand Down
0