From 5619c726649446d3e7fbf1cfe0852995fc6c19eb Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Wed, 31 Aug 2016 02:01:59 +0200 Subject: [PATCH 1/2] Solve the issue when having only one subset --- imblearn/ensemble/balance_cascade.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/imblearn/ensemble/balance_cascade.py b/imblearn/ensemble/balance_cascade.py index 500869278..d0ca37bec 100644 --- a/imblearn/ensemble/balance_cascade.py +++ b/imblearn/ensemble/balance_cascade.py @@ -205,6 +205,7 @@ def _sample(self, X, y): # Loop to create the different subsets while b_subset_search: + self.logger.debug('Search boolean: %s', b_subset_search) # Generate an appropriate number of index to extract # from the majority class depending of the false classification # rate of the previous iteration @@ -272,6 +273,7 @@ def _sample(self, X, y): # Check if we have to make an early stopping if self.n_max_subset is not None: + self.logger.debug('Current number of subset %s', n_subsets) if n_subsets == (self.n_max_subset - 1): b_subset_search = False # Select the remaining data @@ -299,6 +301,10 @@ def _sample(self, X, y): self.logger.debug('The number of subset reached is' ' maximum.') + break + # Specific case with n_max_subset = 1 + elif n_subsets > (self.n_max_subset - 1): + break # Also check that we will have enough sample to extract at the # next round From dd5d0c0e2e127cbf8e04eb976c5c8b0ecb92dde5 Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Wed, 31 Aug 2016 02:09:32 +0200 Subject: [PATCH 2/2] Update the history --- doc/whats_new.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 5db36a918..4d992957f 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -17,6 +17,7 @@ Bug fixes - Fixed a bug in :class:`under_sampling.NearMiss` which was not picking the right samples during under sampling for the method 3. By `Guillaume Lemaitre`_. - Fixed a bug in :class:`ensemble.EasyEnsemble`, correction of the `random_state` generation. By `Guillaume Lemaitre`_ and `Christos Aridas`_. +- Fixed a bug in :class:`ensemble.BalanceCascade`, solve the issue to obtain a single array if desired. By `Guillaume Lemaitre`_. New features ~~~~~~~~~~~~