A Tomek Link is defined as a pair of minimally distanced nearest neighbors from opposite classes. If two instances, one from the majority class and one from the minority class, are each other's closest neighbor in the feature space, they form a Tomek Link. These pairs typically represent overlapping regions or noisy points along the class boundary, where the distinction between fraud and legitimate activity is ambiguous.
Glossary
Tomek Links

What is Tomek Links?
A data cleaning method that identifies pairs of minimally distanced nearest neighbors of opposite classes and removes the majority class instance to clarify the decision boundary between overlapping classes.
The Tomek Links algorithm resolves this ambiguity by removing the majority class instance from each identified pair. This acts as a targeted under-sampling technique that does not blindly reduce the majority class size but specifically eliminates borderline and overlapping examples. The result is a cleaner, less noisy dataset with a more well-defined separation between classes, which often improves the performance of classifiers like k-nearest neighbors.
Key Characteristics of Tomek Links
Tomek Links are a data cleaning method that identifies pairs of minimally distanced nearest neighbors of opposite classes and removes the majority class instance to clarify the decision boundary between overlapping classes.
Definition and Core Mechanism
A Tomek Link is defined as a pair of instances (x, y) from opposite classes where no other instance z exists such that the distance d(x, z) < d(x, y) or d(y, z) < d(y, x). In simpler terms, two instances from different classes are each other's nearest neighbor. The core mechanism involves identifying all such pairs and systematically removing the majority class instance from each link. This process directly eliminates overlapping or ambiguous data points that sit exactly on or within the wrong side of the decision boundary, reducing noise and creating a cleaner, more separable class margin for subsequent classifiers.
Mathematical Foundation and Distance Metrics
The algorithm relies on computing a pairwise distance matrix, typically using Euclidean distance for continuous features, though other metrics like Manhattan or Mahalanobis distance can be applied. For each instance, its nearest neighbor is identified. A Tomek Link is formed if and only if two instances are mutual nearest neighbors and belong to different classes. The computational complexity is O(n²) for a naive implementation, making it expensive for very large datasets. Efficient implementations often use k-d trees or ball trees to accelerate the nearest neighbor search, reducing the average complexity to O(n log n).
Effect on the Decision Boundary
By removing majority class instances that intrude into the minority class space, Tomek Links effectively prune the decision boundary. This has two primary effects:
- Noise Reduction: Eliminates borderline and ambiguous majority examples that cause overfitting.
- Margin Maximization: Creates a clearer separation zone between classes, which is particularly beneficial for margin-based classifiers like Support Vector Machines (SVMs). The result is not a balanced dataset but a cleaner one. The class distribution remains imbalanced, but the overlap between classes is significantly reduced, allowing the classifier to learn a more generalizable boundary.
Integration in Hybrid Resampling: SMOTETomek
Tomek Links are rarely used in isolation for imbalanced classification. Their most common application is as the second step in the SMOTETomek hybrid pipeline. This combined method first applies SMOTE to oversample the minority class, creating synthetic examples. However, SMOTE can inadvertently create samples that invade the majority class space, introducing new noise. Applying Tomek Links after SMOTE cleans up this noise by removing the overlapping majority class instances that now sit too close to the new synthetic minority points. This two-step process creates a balanced and well-separated dataset.
Limitations and Practical Considerations
Despite its utility, Tomek Links has key limitations:
- Computational Cost: The O(n²) pairwise distance calculation is prohibitive for datasets with millions of transactions.
- Information Loss: Removing majority class instances can discard valuable information, especially if the overlapping region is large and represents a genuine area of class ambiguity rather than noise.
- No Minority Handling: It only removes majority class samples. Noisy minority class examples that sit deep within the majority space are untouched, potentially acting as outliers that distort the boundary.
- Metric Sensitivity: The definition of a 'link' is highly sensitive to the chosen distance metric and the scale of features, making feature normalization a critical prerequisite.
Comparison with Edited Nearest Neighbors (ENN)
While both are under-sampling methods that clean the majority class, they operate on different principles:
- Tomek Links: Removes only the majority instance from a pair of mutual nearest neighbors of opposite classes. It focuses on the exact boundary line.
- Edited Nearest Neighbors (ENN): Removes any majority instance whose predicted class (based on a k-nearest neighbor vote) differs from its actual class. It cleans a wider region around the boundary. ENN is generally more aggressive in removing majority samples, while Tomek Links is more conservative, only eliminating the most ambiguous, directly opposed pairs. They are often combined in the One-Sided Selection algorithm.
Tomek Links vs. Other Under-Sampling Methods
A feature-level comparison of Tomek Links against other common under-sampling strategies for clarifying decision boundaries in imbalanced classification.
| Feature | Tomek Links | Edited Nearest Neighbors | NearMiss | Random Undersampling |
|---|---|---|---|---|
Removal Criterion | Opposite-class nearest neighbor pairs | Misclassified by k-NN consensus | Distance to minority class instances | Random selection |
Preserves Decision Boundary | ||||
Removes Majority Class Noise | ||||
Removes Redundant Majority Instances | ||||
Computational Complexity | O(n^2) pairwise distance | O(k * n * d) per iteration | O(n * m) distance computation | O(n) random selection |
Risk of Information Loss | Low | Moderate | Moderate to High | High |
Handles High-Dimensional Data | ||||
Deterministic Output |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, concise answers to the most common technical questions about Tomek Links, their role in imbalanced classification, and how they improve fraud detection models.
A Tomek Link is a pair of minimally distanced nearest neighbors of opposite classes. Specifically, two instances E_i and E_j belonging to different classes form a Tomek Link if no other instance E_l exists such that the distance d(E_i, E_l) < d(E_i, E_j) or d(E_j, E_l) < d(E_i, E_j). In practice, these pairs represent points that lie exactly on or very near the class boundary, often representing overlapping regions or noisy samples. The standard Tomek Links algorithm removes only the majority class instance from each pair, effectively cleaning the decision boundary by eliminating ambiguous majority samples that intrude into the minority class space. This clarifies the separation surface for downstream classifiers.
Related Terms
Explore the core techniques used alongside Tomek Links to clarify decision boundaries and handle severe class imbalance in fraud detection models.
SMOTE
Synthetic Minority Over-sampling Technique generates new, artificial minority class examples by interpolating between existing data points in feature space. Unlike random duplication, SMOTE creates plausible synthetic transactions that help the model generalize better to unseen fraud patterns. It is often paired with Tomek Links to clean the resulting overlap.
Edited Nearest Neighbors
An under-sampling method that removes any majority class example whose predicted class differs from its actual class based on its k-nearest neighbors. This effectively eliminates noisy or ambiguous instances that sit deep within the minority class space, serving a similar boundary-cleaning purpose to Tomek Links but with a focus on misclassification rather than minimal distance.
SMOTETomek
A hybrid resampling pipeline that first applies SMOTE to over-sample the minority class, then uses Tomek Links to remove overlapping majority class instances. This two-step process creates a denser minority representation while simultaneously sharpening the decision boundary, often yielding superior F1-scores on highly imbalanced financial datasets.
One-Sided Selection
A combined under-sampling strategy that first removes redundant majority class examples using Tomek Links, then applies Condensed Nearest Neighbors to eliminate instances far from the decision boundary. This retains only the critical majority examples needed to define the class border, significantly reducing dataset size without sacrificing model performance.
Neighborhood Cleaning Rule
An under-sampling algorithm that uses Edited Nearest Neighbors to remove majority class examples and then removes minority class examples that are misclassified by three nearest neighbors. Unlike Tomek Links, which only removes majority instances, NCL cleans both classes to eliminate overlapping noise from the dataset.
Cost-Sensitive Learning
A learning paradigm that assigns different misclassification costs to different error types, penalizing the model more heavily for misclassifying minority class instances. This algorithmic approach biases learning toward the rare class without altering the data distribution, offering an alternative to data-level methods like Tomek Links for handling imbalance.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us