Skip to content
Merged
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions imblearn/_min_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
NUMPY_MIN_VERSION = "1.17.3"
SCIPY_MIN_VERSION = "1.3.2"
PANDAS_MIN_VERSION = "1.0.5"
SKLEARN_MIN_VERSION = "1.1.0"
SKLEARN_MIN_VERSION = "1.1.3"
TENSORFLOW_MIN_VERSION = "2.4.3"
KERAS_MIN_VERSION = "2.4.3"
JOBLIB_MIN_VERSION = "1.0.0"
JOBLIB_MIN_VERSION = "1.1.1"
THREADPOOLCTL_MIN_VERSION = "2.0.0"
PYTEST_MIN_VERSION = "5.0.1"

Expand Down
4 changes: 2 additions & 2 deletions imblearn/over_sampling/_smote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

import numpy as np
from scipy import sparse
from scipy import stats

from sklearn.preprocessing import OneHotEncoder, OrdinalEncoder
from sklearn.utils import check_random_state
from sklearn.utils import _safe_indexing
from sklearn.utils import check_array
from sklearn.utils.sparsefuncs_fast import csr_mean_variance_axis0
from sklearn.utils.sparsefuncs_fast import csc_mean_variance_axis0
from sklearn.utils.fixes import _mode

from ..base import BaseOverSampler
from ...metrics.pairwise import ValueDifferenceMetric
Expand Down Expand Up @@ -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
_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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from collections import Counter

import numpy as np
from scipy.stats import mode

from sklearn.utils import _safe_indexing
from sklearn.utils.fixes import _mode

from ..base import BaseCleaningSampler
from ...utils import check_neighbors_object
Expand Down Expand Up @@ -155,7 +155,7 @@ def _fit_resample(self, X, y):
nnhood_idx = self.nn_.kneighbors(X_class, return_distance=False)[:, 1:]
nnhood_label = y[nnhood_idx]
if self.kind_sel == "mode":
nnhood_label, _ = mode(nnhood_label, axis=1)
nnhood_label, _ = _mode(nnhood_label, axis=1)
nnhood_bool = np.ravel(nnhood_label) == y_class
elif self.kind_sel == "all":
nnhood_label = nnhood_label == target_class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from collections import Counter

import numpy as np
from scipy.stats import mode

from sklearn.utils import _safe_indexing
from sklearn.utils.fixes import _mode

from ..base import BaseCleaningSampler
from ._edited_nearest_neighbours import EditedNearestNeighbours
Expand Down Expand Up @@ -182,7 +182,7 @@ def _fit_resample(self, X, y):
nnhood_idx = self.nn_.kneighbors(X_class, return_distance=False)[:, 1:]
nnhood_label = y[nnhood_idx]
if self.kind_sel == "mode":
nnhood_label_majority, _ = mode(nnhood_label, axis=1)
nnhood_label_majority, _ = _mode(nnhood_label, axis=1)
nnhood_bool = np.ravel(nnhood_label_majority) == y_class
elif self.kind_sel == "all":
nnhood_label_majority = nnhood_label == class_minority
Expand Down