Skip to content

Commit

Permalink
Fix the bug about the indices of CNN
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Lemaitre committed Aug 30, 2016
1 parent f905274 commit 197c119
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions imblearn/under_sampling/condensed_nearest_neighbour.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ def _sample(self, X, y):
sel_x = np.squeeze(S_x[idx_maj_sample, :])
sel_y = S_y[idx_maj_sample]

# The indexes found are relative to the current class, we need to
# find the absolute value
# Build the array with the absolute position
abs_pos = np.flatnonzero(y == key)
idx_maj_sample = abs_pos[idx_maj_sample]

# If we need to offer support for the indices selected
if self.return_indices:
idx_under = np.concatenate((idx_under, idx_maj_sample), axis=0)
Expand Down

0 comments on commit 197c119

Please sign in to comment.