Skip to content

Commit 812143a

Browse files
author
Guillaume Lemaitre
committed
try to force the raising
1 parent d291eb0 commit 812143a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

imblearn/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
from six import string_types
2121

22-
logging.captureWarnings(False)
23-
warnings.simplefilter('always', UserWarning)
24-
2522

2623
class SamplerMixin(six.with_metaclass(ABCMeta, BaseEstimator)):
2724

@@ -92,6 +89,7 @@ def fit(self, X, y):
9289
self.logger.debug('Shall we raise a warning: %s',
9390
np.unique(y).size == 1)
9491
if np.unique(y).size == 1:
92+
warnings.simplefilter('always', UserWarning)
9593
warnings.warn('Only one class detected, something will get wrong')
9694
self.logger.debug('The warning should has been raised.')
9795

@@ -262,6 +260,7 @@ def fit(self, X, y):
262260

263261
# Check that the target type is binary
264262
if not type_of_target(y) == 'binary':
263+
warnings.simplefilter('always', UserWarning)
265264
warnings.warn('The target type should be binary.')
266265

267266
return self
@@ -298,6 +297,7 @@ def fit(self, X, y):
298297
# Check that the target type is either binary or multiclass
299298
if not (type_of_target(y) == 'binary' or
300299
type_of_target(y) == 'multiclass'):
300+
warnings.simplefilter('always', UserWarning)
301301
warnings.warn('The target type should be binary or multiclass.')
302302

303303
return self

0 commit comments

Comments
 (0)