Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Bug fixes

- Fixed a bug in :class:`under_sampling.NearMiss` which was not picking the right samples during under sampling for the method 3. By `Guillaume Lemaitre`_.
- Fixed a bug in :class:`ensemble.EasyEnsemble`, correction of the `random_state` generation. By `Guillaume Lemaitre`_ and `Christos Aridas`_.
- Fixed a bug in :class:`under_sampling.CondensedNeareastNeigbour`, correction of the list of indices returned. By `Guillaume Lemaitre`_.

New features
~~~~~~~~~~~~
Expand Down
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