Skip to content
Merged
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
8 changes: 5 additions & 3 deletions imblearn/under_sampling/nearmiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ def _selection_dist_based(self, X, y, dist_vec, num_samples, key,

# Throw a warning to tell the user that we did not have enough samples
# to select and that we just select everything
warnings.warn('The number of the samples to be selected is larger than'
' the number of samples available. The balancing ratio'
' cannot be ensure and all samples will be returned.')
if len(sorted_idx) < num_samples:
warnings.warn('The number of the samples to be selected is larger'
' than the number of samples available. The'
' balancing ratio cannot be ensure and all samples'
' will be returned.')

# Select the desired number of samples
sel_idx = sorted_idx[:num_samples]
Expand Down