@@ -95,13 +95,7 @@ def fit_resample(self, X, y):
95
95
if self ._y_name is not None :
96
96
y_ = pd .Series (y_ , dtype = self ._y_dtype , name = self ._y_name )
97
97
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 ])
105
99
106
100
# define an alias for back-compatibility
107
101
fit_sample = fit_resample
@@ -301,15 +295,8 @@ def fit_resample(self, X, y):
301
295
if self ._y_name is not None :
302
296
y_ = pd .Series (y_ , dtype = self ._y_dtype , name = self ._y_name )
303
297
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
313
300
314
301
def _fit_resample (self , X , y ):
315
302
func = _identity if self .func is None else self .func
0 commit comments