Tomek Links
When two classes overlap in feature space, the “border” between them gets messy. Tomek Links are a simple way to spot those messy border cases and clean up a training set so a classifier can learn a clearer separation.
What a Tomek Link is
Take any two examples x and y from different classes. They form a Tomek Link if they are each other’s nearest neighbor (under a chosen distance like Euclidean distance). Intuitively, that mutual “closest pair” across classes signals one of two things:
- Class overlap: the classes genuinely intermix in that region.
- Noise or borderline points: at least one of the two points is atypical or mislabeled.
The figure below makes this concrete: each green ellipse rings a blue–orange pair that are each other’s closest neighbor across the class boundary, and they cluster exactly where the two classes intermix.
In imbalanced classification, Tomek Links are mainly used as a targeted form of under-sampling: you remove examples involved in Tomek Links (commonly the majority-class member, sometimes both) to reduce ambiguity near the decision boundary.
How it’s used in practice
Common workflows pair Tomek Links with oversampling. For example, in fraud detection you might generate minority examples with SMOTE, then apply Tomek Links to delete majority points that sit uncomfortably close to fraud cases—reducing “blended” neighborhoods that confuse the model.
- In customer churn, it can remove non-churn customers that look nearly identical to churners, sharpening the boundary.
- In medical diagnosis, it can reduce the influence of borderline negatives that resemble positives.
from imblearn.combine import SMOTETomek
X_res, y_res = SMOTETomek().fit_resample(X, y)
Why it matters
Many classifiers (k-NN, logistic regression, SVMs, boosted trees) are sensitive to confusing boundary regions. Ignoring overlap can inflate false negatives on the minority class or lead to overly complex boundaries. Tomek Links offer a concrete, geometry-based way to simplify the hardest parts of the dataset without blindly discarding large chunks of the majority class.
Tomek Links are pairs of nearest-neighbor samples from different classes that are each other’s closest neighbor, indicating borderline overlap or potential label noise. In imbalanced classification, removing one or both samples in each Tomek Link (commonly the majority-class point) performs targeted under-sampling and class-boundary cleaning. This matters because it reduces ambiguity near the decision boundary, improving separability and downstream classifier performance.
Imagine two crowds wearing different colored shirts, and you’re trying to draw a clear line between them. If you find a pair of people—one from each crowd—standing unusually close together, right at the border, they might be “confusing” cases or even mistakes.
Tomek Links are those close cross-group pairs in a labeled dataset. In supervised learning, they’re used as a simple cleanup trick for imbalanced classification problems (when one class is much rarer than the other). By removing one or both points in each Tomek Link—often from the bigger class—you can reduce overlap and noise, making the boundary between classes easier for a model to learn.