Skip to content

Commit ae57497

Browse files
author
Guillaume Lemaitre
committed
Solve the issue when having only one subset
1 parent f21ea15 commit ae57497

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
@@ -187,6 +187,7 @@ def _sample(self, X, y):
187187

188188
# Loop to create the different subsets
189189
while b_subset_search:
190+
self.logger.debug('Search boolean: %s', b_subset_search)
190191
# Generate an appropriate number of index to extract
191192
# from the majority class depending of the false classification
192193
# rate of the previous iteration
@@ -254,6 +255,7 @@ def _sample(self, X, y):
254255

255256
# Check if we have to make an early stopping
256257
if self.n_max_subset is not None:
258+
self.logger.debug('Current number of subset %s', n_subsets)
257259
if n_subsets == (self.n_max_subset - 1):
258260
b_subset_search = False
259261
# Select the remaining data
@@ -281,6 +283,10 @@ def _sample(self, X, y):
281283

282284
self.logger.debug('The number of subset reached is'
283285
' maximum.')
286+
break
287+
# Specific case with n_max_subset = 1
288+
elif n_subsets > (self.n_max_subset - 1):
289+
break
284290

285291
# Also check that we will have enough sample to extract at the
286292
# next round

0 commit comments

Comments
 (0)