Smote

SMOTE (Synthetic Minority Over-sampling Technique) is the most widely used algorithm for handling imbalanced datasets — creating synthetic examples of the minority class by interpolating between existing minority samples rather than simply duplicating them, which expands the decision boundary and helps the model generalize to unseen minority examples instead of memorizing the few available ones, making it the standard approach for fraud detection, medical diagnosis, and any classification task where one class is dramatically underrepresented.

What Is SMOTE?

  • Definition: An oversampling algorithm that creates synthetic minority class examples by selecting a minority sample, finding its K nearest minority neighbors, and generating new examples along the line segments connecting them in feature space.
  • The Problem: Imbalanced datasets (99.9% legitimate transactions, 0.1% fraud) cause models to achieve high accuracy by simply predicting the majority class every time — 99.9% accuracy but 0% fraud detection.
  • Why Not Just Copy?: Random oversampling (duplicating minority examples) causes overfitting — the model memorizes the exact duplicated examples. SMOTE creates new points between existing examples, expanding the minority class region.

How SMOTE Works

StepProcessExample
1. Select minority sample APick a fraud transactionFeature vector: [amount=$500, time=2am]
2. Find K nearest minority neighborsK=5 nearest fraud pointsNeighbor B: [amount=$800, time=3am]
3. Pick one neighbor randomlyChoose neighbor B
4. Generate synthetic point on line A→BRandom point between A and BNew: [amount=$650, time=2:30am]
5. Repeat until balancedContinue until minority count matches majority

Formula: $X_{new} = X_A + \lambda \times (X_B - X_A)$ where $\lambda \in [0, 1]$ is random.

SMOTE Variants

VariantModificationWhen to Use
SMOTE (original)Interpolate between any minority neighborsGeneral imbalance
Borderline-SMOTEOnly oversample minority points near the decision boundaryWhen boundary samples matter most
SMOTE-ENNSMOTE + remove noisy samples (Edited Nearest Neighbors)Reduce overlap after oversampling
SMOTE-TomekSMOTE + remove Tomek links (ambiguous boundary pairs)Cleaner decision boundaries
ADASYNGenerate more synthetic samples for harder-to-learn minority examplesAdaptive to local difficulty
SMOTE-NCHandles mixed numeric + categorical featuresDatasets with categorical columns

SMOTE vs Alternatives

TechniqueApproachProsCons
Random OversamplingDuplicate minority examplesSimpleOverfitting on duplicates
SMOTEInterpolate new minority examplesBetter generalizationCan create noisy examples in overlapping regions
Random UndersamplingRemove majority examplesFast, reduces data sizeLoses potentially useful majority info
Class WeightsIncrease loss penalty for minorityNo data manipulationDoesn't add new information
ADASYNAdaptive SMOTE (more synthetics for harder examples)Focuses on hard casesMore complex

Python Implementation

from imblearn.over_sampling import SMOTE

smote = SMOTE(random_state=42, k_neighbors=5)
X_resampled, y_resampled = smote.fit_resample(X_train, y_train)
# Now minority class has same count as majority

Critical Rule: Only apply SMOTE to training data, NEVER to test/validation data. Synthetic examples in the test set would give inflated performance estimates.

SMOTE is the standard oversampling algorithm for imbalanced classification — creating synthetic minority examples through feature-space interpolation that expands the decision boundary and improves generalization, with variants like Borderline-SMOTE and SMOTE-ENN that further refine the synthetic samples for cleaner class separation.

Take smote further

Ask the copilot about this term, or have our engineers assess it against your process.