Skip to content

Commit 1660c23

Browse files
author
Guillaume Lemaitre
committed
Merge branch 'issue_142'
Conflicts: doc/whats_new.rst
2 parents f052175 + dd5d0c0 commit 1660c23

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

doc/whats_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Bug fixes
2020
- Fixed a bug in :class:`under_sampling.RepeatedEditedNearestNeighbours`, add additional stopping criterion to avoid that the minority class become a majority class or that a class disappear. By `Guillaume Lemaitre`_.
2121
- Fixed a bug in :class:`under_sampling.AllKNN`, add stopping criteria to avoid that the minority class become a majority class or that a class disappear. By `Guillaume Lemaitre`_.
2222
- Fixed a bug in :class:`under_sampling.CondensedNeareastNeigbour`, correction of the list of indices returned. By `Guillaume Lemaitre`_.
23+
- Fixed a bug in :class:`ensemble.BalanceCascade`, solve the issue to obtain a single array if desired. By `Guillaume Lemaitre`_.
2324

2425
New features
2526
~~~~~~~~~~~~

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)