Skip to content

Commit 1b4aa9c

Browse files
committed
iter
1 parent c4777f5 commit 1b4aa9c

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

imblearn/base.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,7 @@ def fit_resample(self, X, y):
9595
if self._y_name is not None:
9696
y_ = pd.Series(y_, dtype=self._y_dtype, name=self._y_name)
9797

98-
if binarize_y:
99-
if len(output) == 2:
100-
return X_, y_
101-
return X_, y_, output[2]
102-
if len(output) == 2:
103-
return X_, y_
104-
return X_, y_, output[2]
98+
return (X_, y_) if len(output) == 2 else (X_, y_, output[2])
10599

106100
# define an alias for back-compatibility
107101
fit_sample = fit_resample
@@ -301,15 +295,8 @@ def fit_resample(self, X, y):
301295
if self._y_name is not None:
302296
y_ = pd.Series(y_, dtype=self._y_dtype, name=self._y_name)
303297

304-
if binarize_y:
305-
if len(output) == 2:
306-
return X_, y_
307-
return X_, y_, output[2]
308-
else:
309-
X_, y_ = output[0], output[1]
310-
if len(output) == 2:
311-
return X_, y_
312-
return X_, y_, output[2]
298+
return (X_, y_) if len(output) == 2 else (X_, y_, output[2])
299+
return output
313300

314301
def _fit_resample(self, X, y):
315302
func = _identity if self.func is None else self.func

0 commit comments

Comments
 (0)