Skip to content

Commit 5693cba

Browse files
committed
MNT adapt for scikit-learn 1.1 (#902)
1 parent ef4edde commit 5693cba

File tree

13 files changed

+176
-132
lines changed

13 files changed

+176
-132
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- repo: https://github.com/psf/black
9-
rev: 21.6b0
9+
rev: 22.3.0
1010
hooks:
1111
- id: black
1212
- repo: https://gitlab.com/pycqa/flake8

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
2828
.. _Black: :target: https://github.com/psf/black
2929

30-
.. |PythonMinVersion| replace:: 3.7
31-
.. |NumPyMinVersion| replace:: 1.14.6
32-
.. |SciPyMinVersion| replace:: 1.1.0
33-
.. |ScikitLearnMinVersion| replace:: 1.0.1
34-
.. |MatplotlibMinVersion| replace:: 2.2.3
35-
.. |PandasMinVersion| replace:: 0.25.0
30+
.. |PythonMinVersion| replace:: 3.8
31+
.. |NumPyMinVersion| replace:: 1.17.3
32+
.. |SciPyMinVersion| replace:: 1.3.2
33+
.. |ScikitLearnMinVersion| replace:: 1.1.0
34+
.. |MatplotlibMinVersion| replace:: 3.1.2
35+
.. |PandasMinVersion| replace:: 1.0.5
3636
.. |TensorflowMinVersion| replace:: 2.4.3
3737
.. |KerasMinVersion| replace:: 2.4.3
3838
.. |SeabornMinVersion| replace:: 0.9.0

azure-pipelines.yml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
versionSpec: '3.9'
4646
- bash: |
4747
# Include pytest compatibility with mypy
48-
pip install pytest flake8 mypy==0.782 black==21.6b0
48+
pip install pytest flake8 mypy==0.782 black==22.3
4949
displayName: Install linters
5050
- bash: |
5151
black --check --diff .
@@ -115,7 +115,7 @@ jobs:
115115
py37_conda_forge_openblas_ubuntu_1804:
116116
DISTRIB: 'conda'
117117
CONDA_CHANNEL: 'conda-forge'
118-
PYTHON_VERSION: '3.7'
118+
PYTHON_VERSION: '3.8'
119119
BLAS: 'openblas'
120120
COVERAGE: 'false'
121121

@@ -140,13 +140,13 @@ jobs:
140140
PANDAS_VERSION: 'none'
141141
THREADPOOLCTL_VERSION: 'min'
142142
COVERAGE: 'false'
143-
# Linux + Python 3.7 build with OpenBLAS and without SITE_JOBLIB
143+
# Linux + Python 3.8 build with OpenBLAS and without SITE_JOBLIB
144144
py37_conda_defaults_openblas:
145145
DISTRIB: 'conda'
146-
CONDA_CHANNEL: 'defaults' # Anaconda main channel
147-
PYTHON_VERSION: '3.7'
146+
CONDA_CHANNEL: 'conda-forge'
147+
PYTHON_VERSION: '3.8'
148148
BLAS: 'openblas'
149-
NUMPY_VERSION: '1.16.6' # we cannot get an older version of the dependencies resolution
149+
NUMPY_VERSION: '1.19.5' # we cannot get an older version of the dependencies resolution
150150
SCIPY_VERSION: 'min'
151151
SKLEARN_VERSION: 'min'
152152
MATPLOTLIB_VERSION: 'none'
@@ -177,7 +177,7 @@ jobs:
177177
conda_tensorflow_minimum:
178178
DISTRIB: 'conda-minimum-tensorflow'
179179
CONDA_CHANNEL: 'conda-forge'
180-
PYTHON_VERSION: '3.7'
180+
PYTHON_VERSION: '3.8'
181181
SKLEARN_VERSION: 'min'
182182
TENSORFLOW_VERSION: 'min'
183183
TEST_DOCS: 'true'
@@ -201,33 +201,34 @@ jobs:
201201
conda_keras_minimum:
202202
DISTRIB: 'conda-minimum-keras'
203203
CONDA_CHANNEL: 'conda-forge'
204-
PYTHON_VERSION: '3.7'
204+
PYTHON_VERSION: '3.8'
205205
SKLEARN_VERSION: 'min'
206206
KERAS_VERSION: 'min'
207207
TEST_DOCS: 'true'
208208
TEST_DOCSTRINGS: 'false' # it is going to fail because of scikit-learn inheritance
209209
CHECK_WARNINGS: 'true'
210210

211-
- template: build_tools/azure/posix-docker.yml
212-
parameters:
213-
name: Linux_Docker
214-
vmImage: ubuntu-20.04
215-
dependsOn: [linting, git_commit]
216-
condition: |
217-
and(
218-
succeeded(),
219-
not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]')),
220-
ne(variables['Build.Reason'], 'Schedule')
221-
)
222-
matrix:
223-
debian_atlas_32bit:
224-
DISTRIB: 'debian-32'
225-
DOCKER_CONTAINER: 'i386/debian:10.9'
226-
JOBLIB_VERSION: 'min'
227-
# disable pytest xdist due to unknown bug with 32-bit container
228-
PYTEST_XDIST_VERSION: 'none'
229-
PYTEST_VERSION: 'min'
230-
THREADPOOLCTL_VERSION: '2.2.0'
211+
# Currently runs on Python 3.8 while only Python 3.7 available
212+
# - template: build_tools/azure/posix-docker.yml
213+
# parameters:
214+
# name: Linux_Docker
215+
# vmImage: ubuntu-20.04
216+
# dependsOn: [linting, git_commit]
217+
# condition: |
218+
# and(
219+
# succeeded(),
220+
# not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]')),
221+
# ne(variables['Build.Reason'], 'Schedule')
222+
# )
223+
# matrix:
224+
# debian_atlas_32bit:
225+
# DISTRIB: 'debian-32'
226+
# DOCKER_CONTAINER: 'i386/debian:10.9'
227+
# JOBLIB_VERSION: 'min'
228+
# # disable pytest xdist due to unknown bug with 32-bit container
229+
# PYTEST_XDIST_VERSION: 'none'
230+
# PYTEST_VERSION: 'min'
231+
# THREADPOOLCTL_VERSION: '2.2.0'
231232

232233
- template: build_tools/azure/posix.yml
233234
parameters:
@@ -266,14 +267,14 @@ jobs:
266267
ne(variables['Build.Reason'], 'Schedule')
267268
)
268269
matrix:
269-
py37_conda_forge_mkl:
270+
8_conda_forge_mkl:
270271
DISTRIB: 'conda'
271272
CONDA_CHANNEL: 'conda-forge'
272-
PYTHON_VERSION: '3.7'
273+
PYTHON_VERSION: '3.8'
273274
CHECK_WARNINGS: 'true'
274275
PYTHON_ARCH: '64'
275276
PYTEST_VERSION: '*'
276277
COVERAGE: 'true'
277-
py37_pip_openblas_32bit:
278-
PYTHON_VERSION: '3.7'
278+
py38_pip_openblas_32bit:
279+
PYTHON_VERSION: '3.8'
279280
PYTHON_ARCH: '32'

imblearn/_min_dependencies.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
"""All minimum dependencies for imbalanced-learn."""
22
import argparse
33

4-
# numpy scipy and cython should by in sync with pyproject.toml
5-
# We pinned PyWavelet (a scikit-image dependence) to 1.1.1 in the minimum
6-
# documentation CI builds that is the latest version that support our
7-
# minimum NumPy version required. If PyWavelets 1.2+ is installed, it would
8-
# require NumPy 1.17+ that trigger a bug with Pandas 0.25:
9-
# https://github.com/numpy/numpy/issues/18355#issuecomment-774610226
10-
# When upgrading NumPy, we can unpin PyWavelets but we need to update the
11-
# minimum version of Pandas >= 1.0.5.
12-
NUMPY_MIN_VERSION = "1.14.6"
13-
SCIPY_MIN_VERSION = "1.1.0"
14-
PANDAS_MIN_VERSION = "0.25.0"
15-
SKLEARN_MIN_VERSION = "1.0.1"
4+
NUMPY_MIN_VERSION = "1.17.3"
5+
SCIPY_MIN_VERSION = "1.3.2"
6+
PANDAS_MIN_VERSION = "1.0.5"
7+
SKLEARN_MIN_VERSION = "1.1.0"
168
TENSORFLOW_MIN_VERSION = "2.4.3"
179
KERAS_MIN_VERSION = "2.4.3"
18-
JOBLIB_MIN_VERSION = "0.11"
10+
JOBLIB_MIN_VERSION = "1.0.0"
1911
THREADPOOLCTL_MIN_VERSION = "2.0.0"
2012
PYTEST_MIN_VERSION = "5.0.1"
2113

22-
2314
# 'build' and 'install' is included to have structured metadata for CI.
2415
# It will NOT be included in setup's extras_require
2516
# The values are (version_spec, comma separated tags)
@@ -32,13 +23,13 @@
3223
"pandas": (PANDAS_MIN_VERSION, "optional, docs, examples, tests"),
3324
"tensorflow": (TENSORFLOW_MIN_VERSION, "optional, docs, examples, tests"),
3425
"keras": (KERAS_MIN_VERSION, "optional, docs, examples, tests"),
35-
"matplotlib": ("2.2.3", "docs, examples"),
26+
"matplotlib": ("3.1.2", "docs, examples"),
3627
"seaborn": ("0.9.0", "docs, examples"),
3728
"memory_profiler": ("0.57.0", "docs"),
3829
"pytest": (PYTEST_MIN_VERSION, "tests"),
3930
"pytest-cov": ("2.9.0", "tests"),
4031
"flake8": ("3.8.2", "tests"),
41-
"black": ("21.6b0", "tests"),
32+
"black": ("22.3.0", "tests"),
4233
"mypy": ("0.770", "tests"),
4334
"sphinx": ("4.2.0", "docs"),
4435
"sphinx-gallery": ("0.7.0", "docs"),

imblearn/datasets/tests/test_imbalance.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import numpy as np
1010

1111
from sklearn.datasets import load_iris
12-
from sklearn.datasets import fetch_openml
1312

1413
from imblearn.datasets import make_imbalance
1514

@@ -60,18 +59,20 @@ def test_make_imbalance_dict(iris, sampling_strategy, expected_counts):
6059
"sampling_strategy, expected_counts",
6160
[
6261
(
63-
{"Iris-setosa": 10, "Iris-versicolor": 20, "Iris-virginica": 30},
64-
{"Iris-setosa": 10, "Iris-versicolor": 20, "Iris-virginica": 30},
62+
{"setosa": 10, "versicolor": 20, "virginica": 30},
63+
{"setosa": 10, "versicolor": 20, "virginica": 30},
6564
),
6665
(
67-
{"Iris-setosa": 10, "Iris-versicolor": 20},
68-
{"Iris-setosa": 10, "Iris-versicolor": 20, "Iris-virginica": 50},
66+
{"setosa": 10, "versicolor": 20},
67+
{"setosa": 10, "versicolor": 20, "virginica": 50},
6968
),
7069
],
7170
)
7271
def test_make_imbalanced_iris(as_frame, sampling_strategy, expected_counts):
7372
pytest.importorskip("pandas")
74-
X, y = fetch_openml("iris", version=1, return_X_y=True, as_frame=as_frame)
73+
iris = load_iris(as_frame=True)
74+
X, y = iris.data, iris.target
75+
y = iris.target_names[iris.target]
7576
X_res, y_res = make_imbalance(X, y, sampling_strategy=sampling_strategy)
7677
if as_frame:
7778
assert hasattr(X_res, "loc")

0 commit comments

Comments
 (0)