Skip to content

Commit 2453ca1

Browse files
committed
iter
1 parent acb8234 commit 2453ca1

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

imblearn/over_sampling/_random_over_sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def __init__(
157157

158158
def _check_X_y(self, X, y):
159159
y, binarize_y = check_target_type(y, indicate_one_vs_all=True)
160-
X = _check_X(X)
160+
X = _check_X(self, X)
161161
_check_n_features(self, X, reset=True)
162162
_check_feature_names(self, X, reset=True)
163163
return X, y, binarize_y

imblearn/over_sampling/_smote/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def _check_X_y(self, X, y):
608608
features.
609609
"""
610610
y, binarize_y = check_target_type(y, indicate_one_vs_all=True)
611-
X = _check_X(X)
611+
X = _check_X(self, X)
612612
_check_n_features(self, X, reset=True)
613613
_check_feature_names(self, X, reset=True)
614614
return X, y, binarize_y

imblearn/under_sampling/_prototype_selection/_random_under_sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def __init__(
104104

105105
def _check_X_y(self, X, y):
106106
y, binarize_y = check_target_type(y, indicate_one_vs_all=True)
107-
X = _check_X(X)
107+
X = _check_X(self, X)
108108
_check_n_features(self, X, reset=True)
109109
_check_feature_names(self, X, reset=True)
110110
return X, y, binarize_y

imblearn/utils/_validation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
import sklearn
1515
from sklearn.base import clone
1616
from sklearn.neighbors import NearestNeighbors
17-
from sklearn.utils import check_array, column_or_1d
17+
from sklearn.utils import column_or_1d
1818
from sklearn.utils.fixes import parse_version
1919
from sklearn.utils.multiclass import type_of_target
2020
from sklearn.utils.validation import _num_samples
2121

22-
from .fixes import _is_pandas_df
22+
from .fixes import _is_pandas_df, validate_data
2323

2424
SAMPLING_KIND = (
2525
"over-sampling",
@@ -638,7 +638,7 @@ def inner_f(*args, **kwargs):
638638
return inner_f
639639

640640

641-
def _check_X(X):
641+
def _check_X(estimator, X):
642642
"""Check X and do not check it if a dataframe."""
643643
n_samples = _num_samples(X)
644644
if n_samples < 1:
@@ -648,6 +648,6 @@ def _check_X(X):
648648
if _is_pandas_df(X):
649649
return X
650650

651-
return check_array(
652-
X, dtype=None, accept_sparse=["csr", "csc"], ensure_all_finite=False
651+
return validate_data(
652+
estimator, X, dtype=None, accept_sparse=["csr", "csc"], ensure_all_finite=False
653653
)

0 commit comments

Comments
 (0)