What is a Tomek link?

Last updated 15 November 2026

A Tomek link is a pair of samples from opposite classes that are each other's nearest neighbor. Such pairs sit on the class boundary or indicate noise, so removing them cleans up class overlap.

  • Definition:

    • Samples a (class 0) and b (class 1) form a link if no sample x satisfies d(a,x) < d(a,b) or d(b,x) < d(a,b).

    • Put simply, they are mutual 1-nearest neighbors with different labels.

  • Interpretation: either both points lie right on the boundary, or one of them is noise or mislabeled.

  • Use as undersampling:

    • Typically only the majority member is removed, which widens the margin around minority points.

    • Removing both members is used for pure data cleaning, for example after SMOTE.

  • Limitations:

    • It removes only a few samples, so it is a cleaning step, not a way to reach balance.

    • It depends on a meaningful distance metric, so features must be scaled.

  • In imbalanced-learn, use TomekLinks(sampling_strategy='auto'), which removes majority members by default.

  • https://medium.com/@ksimardeep126/tomek-links-an-undersampling-approach-28f8d703c6a0
  • https://krishnapullak.medium.com/tomek-links-undersampling-technique-for-fraud-detection-84158e3e7deb
  • https://imbalanced-learn.org/dev/under_sampling.html
All Imbalanced Datasets interview questions