ADASYN (Adaptive Synthetic Sampling) is a machine learning technique that generates synthetic data points for the minority class in an imbalanced dataset, with a focus on examples that are harder to learn. Unlike uniform methods, it calculates a density distribution to weight the generation of new samples, creating more synthetic data for minority class instances that are closer to the majority class and thus more difficult to classify. This adaptive approach aims to shift the classification decision boundary toward a more balanced and generalizable solution.
Glossary
ADASYN (Adaptive Synthetic Sampling)

What is ADASYN (Adaptive Synthetic Sampling)?
ADASYN is an advanced oversampling algorithm for handling imbalanced datasets by adaptively generating synthetic data for the minority class.
The algorithm operates by first identifying each minority class example's k-nearest neighbors. It then computes a learning difficulty ratio based on the proportion of majority class neighbors, which dictates how many synthetic samples to generate for that point. New instances are created via linear interpolation between the original minority example and one of its randomly selected minority neighbors. This method is particularly effective for tabular data in classification tasks, as it directly addresses the underlying data distribution challenge rather than applying a simple, uniform oversampling strategy.
Key Characteristics of ADASYN
ADASYN (Adaptive Synthetic Sampling) is an intelligent oversampling algorithm that generates synthetic data for the minority class in imbalanced datasets. Its core innovation is weighting the generation of new samples based on the local learning difficulty of existing minority examples.
Adaptive Sample Generation
Unlike uniform oversampling methods, ADASYN adaptively determines how many synthetic samples to generate for each minority class instance. It calculates a density distribution where more samples are created for minority examples that are harder to learn—typically those surrounded by majority class neighbors. This focuses the synthetic data on the decision boundary, where classification is most challenging.
- Mechanism: For each minority sample
xi, the algorithm computes itsknearest neighbors and finds the ratioriof majority class samples among them. - Normalization:
riis normalized to create a probability distribution. - Generation Count: The total number of synthetic samples to generate for
xiis proportional to its normalizedri.
Focus on Learning Difficulty
ADASYN's primary objective is to reduce bias and shift the classifier's decision boundary toward the difficult-to-learn minority class regions. It directly addresses the class imbalance problem by synthetically creating data where the model's current performance is poorest.
- Learning Difficulty Metric: Defined locally by the imbalance ratio in the neighborhood of a minority instance.
- Impact: By generating more data for "hard" examples, the resulting classifier becomes more robust and generalizes better to minority class patterns that are underrepresented and complex.
- Contrast with SMOTE: While SMOTE generates a fixed number of samples per minority instance, ADASYN's adaptive approach often leads to superior performance on highly imbalanced datasets with complex distributions.
Synthetic Data Creation Process
For each selected minority class instance, ADASYN creates new data points through linear interpolation in feature space between the instance and one of its k nearest minority class neighbors.
- Step 1: Select a neighbor from the
knearest minority class neighbors of the original samplexi. - Step 2: Calculate the difference vector between the feature vectors of
xiand the selected neighbor. - Step 3: Generate a new sample:
x_new = xi + λ * (x_zi - xi), whereλis a random number between 0 and 1. - Result: This creates a synthetic sample that lies on the line segment between two existing minority class samples, preserving the local data manifold structure.
Automated Decision Boundary Shift
The adaptive nature of ADASYN automatically adjusts the classifier's decision boundary without manual intervention. By concentrating synthetic data in regions of high uncertainty, it forces the learning algorithm to devote more capacity to these areas.
- Boundary Effect: The generated samples effectively dilute the influence of the majority class near the boundary.
- Reduced Variance: Helps in reducing the variance of the estimator for the minority class by providing more examples from its true distribution.
- Use Case: Particularly effective for datasets where the minority class is not only rare but also forms multiple, small sub-clusters within the feature space.
Integration in Imbalanced Learning Pipelines
ADASYN is typically applied as a preprocessing step before training a classifier. It is model-agnostic and can be combined with various algorithms like Support Vector Machines, Random Forests, or Neural Networks.
- Standard Workflow: 1. Compute class imbalance ratio. 2. Apply ADASYN to the training set only. 3. Train classifier on the balanced dataset. 4. Evaluate on the original, untouched test set.
- Parameter Tuning: Key hyperparameters include:
n_neighbors: Number of nearest neighbors to consider (default is often 5).sampling_strategy: Desired ratio of minority to majority class after generation.
- Consideration: While it reduces bias, excessive generation can lead to overfitting to the synthetic examples, especially if the original minority sample count is extremely low.
Evaluation and Limitations
The success of ADASYN is measured by improvements in minority class recall, F1-score, G-mean, or Area Under the Precision-Recall Curve (AUPRC) on a held-out test set.
- Key Limitation - Noise Amplification: If the original minority class data contains noise or outliers, ADASYN can amplify these artifacts by generating synthetic samples around them, potentially degrading model performance.
- Computational Cost: The need to compute
k-nearest neighbors for all minority samples makes it more computationally intensive than random oversampling, especially for large datasets. - Data Type Assumption: Designed primarily for continuous numerical features. Application to datasets with high-cardinality categorical features requires special encoding (e.g., embedding) to make interpolation meaningful.
ADASYN vs. SMOTE: A Technical Comparison
A direct comparison of two key synthetic oversampling techniques for handling class imbalance in tabular data.
| Algorithmic Feature | ADASYN (Adaptive Synthetic Sampling) | SMOTE (Synthetic Minority Over-sampling Technique) |
|---|---|---|
Core Mechanism | Generates synthetic samples adaptively, focusing on harder-to-learn minority class examples. | Generates synthetic samples uniformly via linear interpolation between k-nearest neighbors. |
Adaptivity | ||
Density Distribution | Weighted by the local imbalance ratio and classification difficulty. | Uniform across the minority class feature space. |
Focus Area | Boundary regions and areas with high minority class misclassification. | Entire minority class manifold. |
Handles Within-Class Imbalance | ||
Risk of Overgeneralization | Lower, due to adaptive focus. | Higher, especially in sparse or noisy regions. |
Computational Complexity | O(n²) for nearest neighbor search + adaptive weight calculation. | O(n²) for nearest neighbor search. |
Primary Use Case | Complex, highly imbalanced datasets where minority subclusters are hard to learn. | Moderately imbalanced datasets requiring a straightforward boost in minority samples. |
Implementation and Framework Support
ADASYN is implemented as a preprocessing algorithm, primarily available through specialized machine learning libraries focused on handling class imbalance. Its integration is straightforward, requiring no changes to the underlying classifier's architecture.
Core Python Libraries
ADASYN is most commonly accessed through dedicated imbalance-learn libraries in Python.
- imbalanced-learn (imblearn): The primary implementation. Use
from imblearn.over_sampling import ADASYN. It integrates seamlessly with scikit-learn pipelines via afit_resample(X, y)method. - scikit-learn-contrib: The
imbalanced-learnproject is part of the scikit-learn ecosystem, ensuring API compatibility. - Key Parameters:
sampling_strategy(desired minority class ratio),n_neighbors(default=5, for defining local region), andrandom_statefor reproducibility.
Integration with scikit-learn Pipelines
ADASYN functions as a transformer in a Pipeline, ensuring the resampling step is correctly contained within cross-validation folds to prevent data leakage.
Example Pipeline:
pythonfrom sklearn.pipeline import Pipeline from sklearn.ensemble import RandomForestClassifier pipeline = Pipeline([ ('sampler', ADASYN(random_state=42)), ('classifier', RandomForestClassifier()) ])
- Critical Note: The sampler must be placed only in the training fold via
Pipelineor withincross_val_score. Applying it to the entire dataset before splitting is a methodological error.
Algorithmic Steps & Complexity
The implementation follows a defined sequence:
- Compute Class Imbalance Ratio: (d = \frac{N_{majority}}{N_{minority}}).
- Calculate Total Synthetic Samples Needed: (G = (N_{majority} - N_{minority}) \times \beta), where (\beta \in [0, 1]) is the target balance level.
- For each minority example (x_i):
- Find its K-nearest neighbors (KNN) in the feature space.
- Calculate the learning difficulty ratio (r_i) = (majority neighbors among K) / K.
- Normalize (r_i) to a density distribution (\hat{r}_i).
- Determine number of synthetic samples for (x_i): (g_i = G \times \hat{r}_i).
- Generate Samples: For each (g_i), select a random neighbor (x_{zi}) and create a synthetic point: (s = x_i + (x_{zi} - x_i) \times \lambda), where (\lambda) is a random number in ([0, 1]).
- Time Complexity: Dominated by the KNN search, typically (O(n^2)) or (O(n \log n)) with optimizations, making it slower than basic SMOTE for large
n_neighborsvalues.
Framework Support & Extensions
While imbalanced-learn is standard, other frameworks offer support or related concepts.
- Apache Spark MLlib: No native ADASYN, but custom implementation is possible using
KNNandVectoroperations for distributed datasets. - TensorFlow / PyTorch: Not a core offering. ADASYN is a data-level method, independent of the model framework. It is applied to the NumPy/Pandas dataset before tensor conversion.
- Extended Variants: Libraries may include extensions like:
- ADASYN with SVM: Uses support vectors to define harder regions.
- Borderline-ADASYN: Focuses generation more aggressively on minority samples near the class boundary.
Key Considerations for Production
When to Use:
- Your dataset has a moderate to severe class imbalance.
- The decision boundary is complex and minority class examples have varying degrees of learning difficulty.
- You need a data-centric solution without modifying the classifier.
Caveats & Best Practices:
- Noise Amplification: ADASYN can amplify outliers. Pre-clean your data.
- Computational Cost: The KNN step is expensive for very large datasets. Consider approximate nearest neighbors.
- Categorical Features: The standard Euclidean-based KNN fails. Use the SMOTENC variant for mixed data types.
- Validation: Always use a strict train-test split with resampling only on the training set. Evaluate on the pristine, unmodified test set.
Related Techniques & Hybrid Approaches
ADASYN is part of a broader ecosystem of sampling techniques. It is often compared and combined with:
- SMOTE: The predecessor. ADASYN adaptively allocates samples where SMOTE distributes them uniformly.
- Undersampling Methods (e.g., RandomUnderSampler, Tomek Links): Can be combined with ADASYN in an
imblearn.pipeline.FunctionSampleror usingSMOTEENN/SMOTETomekpatterns for hybrid sampling. - Ensemble Methods: EasyEnsemble or BalancedRandomForest are algorithm-level alternatives that internally balance classes.
- Cost-Sensitive Learning: An orthogonal approach that adjusts the classifier's loss function rather than the data, which can be used in conjunction with ADASYN.
Frequently Asked Questions About ADASYN
ADASYN (Adaptive Synthetic Sampling) is an advanced oversampling algorithm designed to address class imbalance in machine learning datasets by generating synthetic data for the minority class. It focuses on creating examples that are harder to learn, thereby improving model performance on difficult-to-classify instances.
ADASYN (Adaptive Synthetic Sampling) is an oversampling algorithm that generates synthetic data for the minority class in an imbalanced dataset, with a focus on creating examples that are harder for a learning algorithm to classify. It works by first calculating the learning difficulty for each minority class example based on the ratio of majority class neighbors in its local region (using k-Nearest Neighbors). It then assigns a higher synthetic data generation density to minority examples that are surrounded by more majority class examples. For each such "difficult" minority instance, the algorithm generates synthetic data points by interpolating between the example and one of its k nearest minority class neighbors, using a random weight. This adaptive approach shifts the classifier's decision boundary toward the more challenging regions of the feature space.
Key Steps:
- Calculate the imbalance ratio for the minority class.
- Determine the total number of synthetic samples to generate.
- For each minority example, find its k-nearest neighbors and compute its local class imbalance ratio.
- Normalize these ratios to create a density distribution, determining how many synthetic samples to generate for each minority instance.
- For each minority example, generate the specified number of synthetic samples via linear interpolation with a randomly selected minority neighbor.
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.
Related Terms in Imbalanced Learning & Synthetic Data
ADASYN operates within a broader ecosystem of techniques for handling class imbalance and generating synthetic data. These cards define key related methodologies and metrics.
SMOTE (Synthetic Minority Over-sampling Technique)
The foundational algorithm upon which ADASYN builds. SMOTE generates synthetic minority class examples by interpolating between a seed instance and one of its k-nearest neighbors in feature space.
- Key Difference: Unlike ADASYN, SMOTE generates a uniform number of synthetic samples for each minority instance, ignoring local class distribution and learning difficulty.
- Process: For a selected minority instance, a synthetic point is created along the line segment connecting it to a randomly chosen neighbor.
- Limitation: Can cause overgeneralization and blur class boundaries in regions where minority and majority classes overlap.
Class Imbalance Ratio
A core metric that defines the problem ADASYN aims to solve. The Class Imbalance Ratio is the proportion of majority class examples to minority class examples in a dataset (e.g., 100:1).
- Impact: High ratios cause models to be biased toward the majority class, leading to poor recall for the minority class.
- ADASYN's Role: ADASYN adaptively reduces this effective ratio by generating more synthetic data for "harder" minority sub-regions.
- Measurement: Often calculated as
N_majority / N_minority. ADASYN's adaptive weighting creates a local imbalance ratio for each minority instance.
Borderline-SMOTE
A direct precursor to ADASYN that introduces the concept of focusing on difficult regions. Borderline-SMOTE identifies "borderline" minority instances—those where more than half of their k-nearest neighbors belong to the majority class—and only generates synthetic samples from these instances.
- Rationale: Instances near the class decision boundary are more critical and harder to classify.
- Comparison to ADASYN: While both focus on difficult areas, ADASYN introduces a finer-grained, adaptive density distribution, whereas Borderline-SMOTE uses a binary (borderline/not borderline) classification.
Learning Difficulty
The central heuristic driving ADASYN's adaptive mechanism. Learning Difficulty for a minority class instance is empirically estimated by the proportion of its k-nearest neighbors that belong to the majority class.
- Calculation:
r_i = (Number of majority neighbors) / k. A higherr_iindicates greater difficulty. - Normalization: These raw ratios are normalized into a density distribution
\hat{r}_i, which determines the number of synthetic samples to generate for each minority instance. - Outcome: Instances in dense majority regions (high learning difficulty) receive more synthetic support, effectively shifting the classification boundary.
K-Nearest Neighbors (k-NN)
The algorithmic backbone for ADASYN's key calculations. k-NN is used twice in the ADASYN process:
- To Estimate Learning Difficulty: For each minority instance, find its k-nearest neighbors in the entire training set to compute
r_i. - To Generate Samples: For each selected minority instance, one of its k-nearest neighbors from the minority class is chosen for interpolation.
- Hyperparameter Sensitivity: The value of
ksignificantly impacts which instances are deemed "difficult" and the diversity of generated samples.
Oversampling vs. Undersampling
ADASYN is an oversampling technique, one of two primary strategies for handling class imbalance.
- Oversampling: Increases the number of minority class instances (e.g., via ADASYN, SMOTE). Advantage: Preserves all original information. Risk: Can lead to overfitting if not done carefully.
- Undersampling: Reduces the number of majority class instances (e.g., random removal, Tomek links). Advantage: Reduces training time. Risk: Discards potentially useful data.
- Hybrid Approaches: Often combine both, such as applying ADASYN to the minority class and a light undersampling to the majority class to prevent model bias.

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