SMOTE generates the same number of synthetic samples for every minority point it visits. That's a reasonable default but a poor strategy. A fraud transaction surrounded by other fraud transactions doesn't need more neighbors — your model already understands that region. A fraud transaction surrounded by legitimate ones is where your model fails, and that's where you want the training signal concentrated.
ADASYN (Adaptive Synthetic Sampling) makes this distinction mathematically. Instead of asking "how many samples do we need?" it asks "which minority points are hardest to classify, and how much should each of them contribute to the synthetic set?"
Same fraud-detection anchor throughout this section: 20 transactions, 4 fraud (minority), 16 legitimate. With all 4 fraud points tightly clustered, ADASYN assigns roughly equal difficulty to each — the anchor is too clean to show the adaptive weighting. The concepts still trace through cleanly because every ratio and weight is computable by hand.
The Core Idea: Difficulty as a Sampling Weight
For each minority point, ADASYN computes a difficulty ratio — a number between 0 and 1 that measures how surrounded by majority-class points it is.
rᵢ = (number of majority neighbors in k-NN of point i) / kA minority point where all k neighbors are also minority gets rᵢ = 0 — it's in a safe region. A minority point where all k neighbors are majority gets rᵢ = 1 — it's completely isolated in enemy territory.
These ratios are then normalized so they sum to 1, turning them into a proper probability distribution:
r̂ᵢ = rᵢ / ΣrᵢNow, given a total budget of G synthetic samples to generate (calculated from the class imbalance), each minority point i contributes:
Gᵢ = G × r̂ᵢHarder points get more synthetic samples. Easier points get fewer — sometimes zero.
Step by Step
from imblearn.over_sampling import ADASYN
sampler = ADASYN(
n_neighbors=5,
sampling_strategy='auto',
random_state=42
)
X_resampled, y_resampled = sampler.fit_resample(X_train, y_train)sampling_strategy='auto' tells ADASYN to balance the minority class up to the majority count. You can pass a float (target ratio) or a dict (per-class target counts) for finer control.
n_neighbors controls the k-NN used for both computing difficulty ratios and generating synthetic samples.
What Changes Compared to SMOTE
With SMOTE on a fraud dataset, if you have 200 fraud transactions and want 1800 synthetic ones, each fraud point generates roughly 9 synthetics. No point gets more because it's harder.
With ADASYN on the same dataset:
- 50 fraud transactions in safe regions → rᵢ ≈ 0 → almost no synthetic samples
- 80 at moderate risk → rᵢ ≈ 0.4 → moderate contribution
- 70 surrounded by legitimate transactions → rᵢ ≈ 0.9 → most of the 1800 synthetics come from here
The classifier gets trained heavily on the genuinely ambiguous cases. This tends to produce better recall on edge cases at the cost of slightly more false positives — a tradeoff that's often exactly right in high-recall domains.
A Practical Comparison
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from imblearn.over_sampling import SMOTE, ADASYN
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y)
for name, sampler in [("SMOTE", SMOTE()), ("ADASYN", ADASYN())]:
X_res, y_res = sampler.fit_resample(X_train, y_train)
clf = RandomForestClassifier(n_estimators=100, random_state=42)
clf.fit(X_res, y_res)
print(f"\n{name}:")
print(classification_report(y_test, clf.predict(X_test)))On highly imbalanced datasets with overlapping classes, ADASYN typically shows better recall on the minority class and slightly lower precision. Whether that tradeoff works depends entirely on your domain.
Where It Breaks
Noisy minority points become expensive. If a minority sample is mislabeled (a legitimate transaction marked as fraud), ADASYN will give it the highest weight — it's surrounded by majority points by definition. You end up generating a lot of synthetic samples around the most unreliable anchor in your dataset. Noise in the minority class punishes ADASYN more than it punishes SMOTE.
Over-aggressiveness near noisy boundaries. In domains where the boundary between classes is genuinely fuzzy (not because of data quality, but because the phenomenon itself is ambiguous), ADASYN can push the classifier too hard into ambiguous territory and hurt overall calibration.
Not deterministic across runs. The difficulty ratio computation is stable, but the synthetic sample generation involves random interpolation. Results can vary meaningfully across random seeds, especially on small datasets. Fix random_state in experiments.
Can't handle categorical features. Like all SMOTE variants, ADASYN interpolates linearly in feature space. Mixed-type datasets with categorical columns need preprocessing (target encoding, etc.) or a different approach entirely.
When to Use It
ADASYN makes sense when:
- Your evaluation shows the minority class precision is acceptable but recall is poor on edge cases specifically
- You have a relatively clean dataset — not many mislabeled minority samples
- You're in a high-recall domain (medical diagnosis, fraud detection, safety systems) where missing a positive is more expensive than a false alarm
- SMOTE gave you marginal improvement and you want a more aggressive boundary-focused strategy
Skip ADASYN when:
- Your minority class has label noise — you'll amplify the wrong points
- Precision is as important as recall — the over-aggressiveness near boundaries can hurt it
- Your dataset is small — the difficulty ratios become unreliable with few samples
ADASYN is SMOTE with a feedback signal. It's not smarter about how it generates samples — the interpolation is identical — but it's smarter about where it concentrates effort. That distinction alone is often enough to push a borderline model into production territory.
Related Concepts
Backward: This post assumes you understand SMOTE's interpolation formula and the concept of k-nearest neighbors used for zone classification in Borderline-SMOTE. ADASYN's difficulty ratio is a refinement of Borderline-SMOTE's safe/borderline/noise idea.
Forward: For aggressive boundary cleaning after oversampling, SMOTE-Tomek and SMOTE-ENN pair ADASYN (or any oversampler) with a post-processing noise-removal step. For non-tabular data, CTGAN and VAE replace linear interpolation entirely.
Honest Limitations
- Amplifies label noise. If a minority sample is mislabeled, ADASYN gives it the highest difficulty weight — it's surrounded by majority points. You generate the most synthetic samples around the most unreliable anchor in your dataset.
- Undefined when all rᵢ = 0. If every minority point is surrounded only by other minority points (perfectly separable data), all difficulty ratios are zero and the normalization step fails. ADASYN falls back to uniform weighting — which is plain SMOTE.
- Hard to calibrate sampling_strategy. The
sampling_strategyparameter controls the target ratio. Combined with per-point weights, it's not obvious how many synthetics each point will actually generate. Tuning is more opaque than SMOTE.
Test Your Understanding
-
A minority point x has k=5 neighbors: 3 majority, 2 minority. What is its difficulty ratio r? If the total Σr across all minority points is 4.2 and the target number of synthetic samples is 100, how many synthetics does x contribute?
-
ADASYN's weight normalization makes it adaptive. In the 4-fraud-point anchor where every fraud point is surrounded by other fraud points, what happens to rᵢ for each? Why does ADASYN degrade to SMOTE here?
-
You have a minority class where 2 out of 10 samples are clearly mislabeled (they cluster with the majority). How does ADASYN behave differently from vanilla SMOTE on these two points? Which variant would you choose and why?
-
The normalization step r̂ᵢ = rᵢ / Σrⱼ ensures weights sum to 1. What happens if a single minority point has rᵢ = 1.0 and all others have rᵢ = 0? How many synthetic samples would that one point generate?
-
ADASYN is described as "over-aggressive near noisy boundaries." Design a small 2D dataset where ADASYN would produce worse boundary placement than Borderline-SMOTE. Sketch it verbally.