Skip to content

Commit

Permalink
Solve the issue when having only one subset
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Lemaitre committed Aug 31, 2016
1 parent f905274 commit 5619c72
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions imblearn/ensemble/balance_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5619c72

Please sign in to comment.