Skip to content
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

MAINT compatibility scikit-learn 1.3 #999

Merged
merged 38 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
iter
  • Loading branch information
glemaitre committed Jul 7, 2023
commit 1895749001ded48f643a8afe5c9bf1d48643ef52
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ repos:
- id: mypy
files: imblearn/
additional_dependencies: [pytest==6.2.4]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.15.0
hooks:
# TODO: add the double-quote-cython-strings hook when it's usability has improved:
# possibility to pass a directory and use it as a check instead of auto-formatter.
- id: cython-lint
2 changes: 1 addition & 1 deletion imblearn/ensemble/_bagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# scikit-learn >= 1.2
from sklearn.utils.parallel import Parallel, delayed
except (ImportError, ModuleNotFoundError):
from sklearn.utils.fixes import delayed
from joblib import Parallel
from sklearn.utils.fixes import delayed

from ..base import _ParamsValidationMixin
from ..pipeline import Pipeline
Expand Down
2 changes: 1 addition & 1 deletion imblearn/ensemble/_easy_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# scikit-learn >= 1.2
from sklearn.utils.parallel import Parallel, delayed
except (ImportError, ModuleNotFoundError):
from sklearn.utils.fixes import delayed
from joblib import Parallel
from sklearn.utils.fixes import delayed

from ..base import _ParamsValidationMixin
from ..pipeline import Pipeline
Expand Down
2 changes: 1 addition & 1 deletion imblearn/ensemble/_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
# scikit-learn >= 1.2
from sklearn.utils.parallel import Parallel, delayed
except (ImportError, ModuleNotFoundError):
from sklearn.utils.fixes import delayed
from joblib import Parallel
from sklearn.utils.fixes import delayed

from ..base import _ParamsValidationMixin
from ..pipeline import make_pipeline
Expand Down
12 changes: 8 additions & 4 deletions imblearn/keras/tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
from keras.utils.np_utils import to_categorical # noqa: E402

from imblearn.datasets import make_imbalance # noqa: E402
from imblearn.keras import BalancedBatchGenerator # noqa: E402
from imblearn.keras import balanced_batch_generator # noqa: E402
from imblearn.keras import (
BalancedBatchGenerator, # noqa: E402
balanced_batch_generator, # noqa: E402
)
from imblearn.over_sampling import RandomOverSampler # noqa: E402
from imblearn.under_sampling import ClusterCentroids # noqa: E402
from imblearn.under_sampling import NearMiss # noqa: E402
from imblearn.under_sampling import (
ClusterCentroids, # noqa: E402
NearMiss, # noqa: E402
)


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion imblearn/over_sampling/_smote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ class SMOTENC(SMOTE):

See
:ref:`sphx_glr_auto_examples_over-sampling_plot_comparison_over_sampling.py`,
and :ref:`sphx_glr_auto_examples_over-sampling_plot_illustration_generation_sample.py`. # noqa
and
:ref:`sphx_glr_auto_examples_over-sampling_plot_illustration_generation_sample.py`.

References
----------
Expand Down
3 changes: 1 addition & 2 deletions imblearn/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def test_pipeline_init():

# Test clone
pipe2 = clone(pipe)
assert not pipe.named_steps["svc"] is pipe2.named_steps["svc"]
assert pipe.named_steps["svc"] is not pipe2.named_steps["svc"]

# Check that apart from estimators, the parameters are the same
params = pipe.get_params(deep=True)
Expand Down Expand Up @@ -1163,7 +1163,6 @@ def test_predict_with_predict_params():


def test_resampler_last_stage_passthrough():

X, y = make_classification(
n_classes=2,
class_sep=2,
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@ include = '\.pyi?$'

[tool.isort]
profile = "black"

[tool.ruff]
# all rules can be found here: https://beta.ruff.rs/docs/rules/
select = ["E", "F", "W", "I"]

# max line length for black
line-length = 88
target-version = "py38"

ignore=[
# space before : (needed for how black formats slicing)
"E203",
# do not assign a lambda expression, use a def
"E731",
# do not use variables named 'l', 'O', or 'I'
"E741",
# Import not on the top of the file
"E402",
]