Skip to content

Commit 5619c72

Browse files
author
Guillaume Lemaitre
committed
Solve the issue when having only one subset
1 parent f905274 commit 5619c72

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

imblearn/ensemble/balance_cascade.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def _sample(self, X, y):
205205

206206
# Loop to create the different subsets
207207
while b_subset_search:
208+
self.logger.debug('Search boolean: %s', b_subset_search)
208209
# Generate an appropriate number of index to extract
209210
# from the majority class depending of the false classification
210211
# rate of the previous iteration
@@ -272,6 +273,7 @@ def _sample(self, X, y):
272273

273274
# Check if we have to make an early stopping
274275
if self.n_max_subset is not None:
276+
self.logger.debug('Current number of subset %s', n_subsets)
275277
if n_subsets == (self.n_max_subset - 1):
276278
b_subset_search = False
277279
# Select the remaining data
@@ -299,6 +301,10 @@ def _sample(self, X, y):
299301

300302
self.logger.debug('The number of subset reached is'
301303
' maximum.')
304+
break
305+
# Specific case with n_max_subset = 1
306+
elif n_subsets > (self.n_max_subset - 1):
307+
break
302308

303309
# Also check that we will have enough sample to extract at the
304310
# next round

0 commit comments

Comments
 (0)