From d33325fd25db6397bf03169e77b695e3e9a61f84 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 09:28:27 -0500 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20`FutureWarning`=20in?= =?UTF-8?q?=20`scipy.stats.mode`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Azure builds were raising an `UNEXPECTED EXCEPTION` with later versions of scipy. This looks like it may be related to an upcoming API change in the `stats.mode` method. This adds `keepdims=True` --- imblearn/over_sampling/_smote/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imblearn/over_sampling/_smote/base.py b/imblearn/over_sampling/_smote/base.py index 6249dc876..09d738141 100644 --- a/imblearn/over_sampling/_smote/base.py +++ b/imblearn/over_sampling/_smote/base.py @@ -786,7 +786,7 @@ def _make_samples(self, X_class, klass, y_dtype, nn_indices, n_samples): # where for each feature individually, each category generated is the # most common category X_new = np.squeeze( - stats.mode(X_class[nn_indices[samples_indices]], axis=1).mode, axis=1 + stats.mode(X_class[nn_indices[samples_indices]], axis=1, keepdims=True).mode, axis=1, ) y_new = np.full(n_samples, fill_value=klass, dtype=y_dtype) return X_new, y_new From 1dab9be1f491136522d746a8531fbcba551005fe Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 09:34:02 -0500 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20lint=20warnings=20by?= =?UTF-8?q?=20running=20`black`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imblearn/over_sampling/_smote/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imblearn/over_sampling/_smote/base.py b/imblearn/over_sampling/_smote/base.py index 09d738141..7b048429c 100644 --- a/imblearn/over_sampling/_smote/base.py +++ b/imblearn/over_sampling/_smote/base.py @@ -786,7 +786,10 @@ def _make_samples(self, X_class, klass, y_dtype, nn_indices, n_samples): # where for each feature individually, each category generated is the # most common category X_new = np.squeeze( - stats.mode(X_class[nn_indices[samples_indices]], axis=1, keepdims=True).mode, axis=1, + stats.mode( + X_class[nn_indices[samples_indices]], axis=1, keepdims=True + ).mode, + axis=1, ) y_new = np.full(n_samples, fill_value=klass, dtype=y_dtype) return X_new, y_new From e39248e4d538700177e85d2edaba0bca0fd07591 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 09:51:15 -0500 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=90=9B=20Drop=20`keepdims`=20to=20b?= =?UTF-8?q?e=20compatible=20with=20`scipy=3D=3D1.3.2`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imblearn/over_sampling/_smote/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imblearn/over_sampling/_smote/base.py b/imblearn/over_sampling/_smote/base.py index 7b048429c..cb07c9e7d 100644 --- a/imblearn/over_sampling/_smote/base.py +++ b/imblearn/over_sampling/_smote/base.py @@ -787,7 +787,8 @@ def _make_samples(self, X_class, klass, y_dtype, nn_indices, n_samples): # most common category X_new = np.squeeze( stats.mode( - X_class[nn_indices[samples_indices]], axis=1, keepdims=True + X_class[nn_indices[samples_indices]], + axis=1, ).mode, axis=1, ) From 774abd64545fea63e8a59c5394c042d6fdb8045e Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 10:12:47 -0500 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=91=B7=20Drop=20`-Werror::FutureWar?= =?UTF-8?q?ning`=20in=20`test=5Fscript`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tools/azure/test_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index 57136b41c..e9109e953 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -36,7 +36,7 @@ fi if [[ -n "$CHECK_WARNINGS" ]]; then # numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage - TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning" + TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Wignore:tostring:DeprecationWarning" # numpy's 1.20's np.object deprecationg is ignored until tensorflow removes its usage TEST_CMD="$TEST_CMD -Wignore:\`np.object\`:DeprecationWarning" From e60da56c3f1060bb93809a8865dc5088eca6182c Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 10:29:47 -0500 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=91=B7=20Drop=20`py38=5Fpip=5Fopenb?= =?UTF-8?q?las=5F32bit`=20from=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- azure-pipelines.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4605d2ced..f1ecb6f9a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -275,6 +275,3 @@ jobs: PYTHON_ARCH: '64' PYTEST_VERSION: '*' COVERAGE: 'true' - py38_pip_openblas_32bit: - PYTHON_VERSION: '3.8' - PYTHON_ARCH: '32' From 1f4035aeba33075d18f17d30ad45c09bf7a31e16 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 10:32:17 -0500 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=9A=A8=20Spacing=20in=20`=5Fsmote/b?= =?UTF-8?q?ase`=20and=20`black`=20the=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imblearn/over_sampling/_smote/base.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/imblearn/over_sampling/_smote/base.py b/imblearn/over_sampling/_smote/base.py index cb07c9e7d..bae19ed46 100644 --- a/imblearn/over_sampling/_smote/base.py +++ b/imblearn/over_sampling/_smote/base.py @@ -786,11 +786,7 @@ def _make_samples(self, X_class, klass, y_dtype, nn_indices, n_samples): # where for each feature individually, each category generated is the # most common category X_new = np.squeeze( - stats.mode( - X_class[nn_indices[samples_indices]], - axis=1, - ).mode, - axis=1, + stats.mode(X_class[nn_indices[samples_indices]], axis=1).mode, axis=1, ) y_new = np.full(n_samples, fill_value=klass, dtype=y_dtype) return X_new, y_new From 5f07ca662d751ce6bde6882f0ccf383f79c7b293 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 10:33:07 -0500 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=8E=A8=20Drop=20comma=20for=20small?= =?UTF-8?q?er=20diff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imblearn/over_sampling/_smote/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imblearn/over_sampling/_smote/base.py b/imblearn/over_sampling/_smote/base.py index bae19ed46..6249dc876 100644 --- a/imblearn/over_sampling/_smote/base.py +++ b/imblearn/over_sampling/_smote/base.py @@ -786,7 +786,7 @@ def _make_samples(self, X_class, klass, y_dtype, nn_indices, n_samples): # where for each feature individually, each category generated is the # most common category X_new = np.squeeze( - stats.mode(X_class[nn_indices[samples_indices]], axis=1).mode, axis=1, + stats.mode(X_class[nn_indices[samples_indices]], axis=1).mode, axis=1 ) y_new = np.full(n_samples, fill_value=klass, dtype=y_dtype) return X_new, y_new From e4eae0f0331fe2e8a51d1c9e622f2a89d311a7a3 Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 15:18:01 -0500 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=91=B7=20Add=20the=20`FutureWarning?= =?UTF-8?q?`=20back=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tools/azure/test_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index e9109e953..57136b41c 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -36,7 +36,7 @@ fi if [[ -n "$CHECK_WARNINGS" ]]; then # numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage - TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Wignore:tostring:DeprecationWarning" + TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning" # numpy's 1.20's np.object deprecationg is ignored until tensorflow removes its usage TEST_CMD="$TEST_CMD -Wignore:\`np.object\`:DeprecationWarning" From 3b0c6f95413a47cede469c816a4de575072482fa Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 15:32:45 -0500 Subject: [PATCH 09/10] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20minimum=20num?= =?UTF-8?q?py=20version=20in=20`py37=5Fconda=5Fdefaults=5Fopenblas`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f1ecb6f9a..d701c8c5d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -146,7 +146,7 @@ jobs: CONDA_CHANNEL: 'conda-forge' PYTHON_VERSION: '3.8' BLAS: 'openblas' - NUMPY_VERSION: '1.19.5' # we cannot get an older version of the dependencies resolution + NUMPY_VERSION: '1.21.0' # we cannot get an older version of the dependencies resolution SCIPY_VERSION: 'min' SKLEARN_VERSION: 'min' MATPLOTLIB_VERSION: 'none' From 6168f83390b2f54d6467668baf8ab6d18b27356f Mon Sep 17 00:00:00 2001 From: hayesall Date: Sat, 12 Nov 2022 15:34:04 -0500 Subject: [PATCH 10/10] =?UTF-8?q?Revert=20"=E2=AC=86=EF=B8=8F=20Bump=20min?= =?UTF-8?q?imum=20numpy=20version=20in=20`py37=5Fconda=5Fdefaults=5Fopenbl?= =?UTF-8?q?as`"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3b0c6f95413a47cede469c816a4de575072482fa. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d701c8c5d..f1ecb6f9a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -146,7 +146,7 @@ jobs: CONDA_CHANNEL: 'conda-forge' PYTHON_VERSION: '3.8' BLAS: 'openblas' - NUMPY_VERSION: '1.21.0' # we cannot get an older version of the dependencies resolution + NUMPY_VERSION: '1.19.5' # we cannot get an older version of the dependencies resolution SCIPY_VERSION: 'min' SKLEARN_VERSION: 'min' MATPLOTLIB_VERSION: 'none'