Skip to main content
← Lab

hartskip

confirmedupstream bugPython · imbalanced-learnSystems & data structuresJuly 25, 2026

the question

Does imbalanced-learn's CondensedNearestNeighbour keep a 1-NN-consistent majority subset when the majority is not in leading rows?

what came out

imbalanced-learn's `CondensedNearestNeighbour._fit_resample` tests a local enumerate position `idx_sam` against `good_classif_label`, which holds global dataset indices. When the majority is spread through X, misclassified samples are wrongly skipped: 192 of 200 seeded datasets violate Hart's consistency, dropping to 0 when the majority is reordered to leading rows.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/hartskip