SMOTE

Also known as: Synthetic minority oversampling technique

On this page 8

SMOTE, the synthetic minority oversampling technique, is a resampling method in machine learning that balances a skewed training set by generating new minority-class examples through interpolation between existing neighbors in feature space. Instead of copying rare records, it places artificial points on the line segments that connect each minority sample to one of its nearest minority neighbors.

Within artificial intelligence practice, SMOTE is one of the most widely used responses to class imbalance, the situation in which one class (fraud, failure, disease) is far rarer than the others. It is applied only to training data, and its value depends heavily on the classifier, the evaluation metric and the geometry of the data.

How SMOTE generates synthetic samples

SMOTE creates each synthetic record by choosing a minority sample, picking one of its k nearest minority neighbors and interpolating at a random point between them. Formally, the new point is x_new = x_i + λ (x_nn – x_i), where λ is drawn uniformly from 0 to 1. The result lies on the segment between two real minority observations.

The neighbor search uses the k-nearest neighbors procedure, usually with Euclidean distance and a default of k = 5. Because distance drives the whole process, feature scaling must be applied first; otherwise a feature measured in thousands dominates one measured in fractions, and the neighbors become meaningless.

The algorithm repeats these steps until the minority class reaches a target size, which is set by a sampling ratio rather than by a fixed count. The following table lists the parameters that control this process.

ParameterTypical valueWhat it controls
Number of neighbors (k)3 to 7, default 5How local the interpolation is
Sampling ratio0.1 to 1.0 of majority sizeHow many synthetic points are created
Distance metricEuclideanWhich samples count as neighbors
Random seedAny fixed integerReproducibility of generated points
Main SMOTE parameters and their effect

Why oversampling helps imbalanced classifiers

SMOTE helps because many learners minimize overall error, and with a 1:100 ratio a model can reach 99 percent accuracy by ignoring the minority class entirely. Adding synthetic minority points shifts the decision boundary away from the rare class and gives the learner more varied regions to cover.

Compared with random oversampling, which duplicates existing rows, SMOTE produces new values and therefore reduces exact-copy overfitting. A decision tree trained on duplicates tends to carve tiny regions around each repeated point, whereas interpolated points encourage broader, smoother minority regions.

SMOTE variants and when each applies

Several SMOTE variants exist because the original method treats all minority samples equally, including noisy ones and those deep inside the minority cluster. The table below summarizes the most common variants.

VariantKey ideaBest suited for
Borderline-SMOTEOversamples only minority points near the boundaryClasses that overlap at the margin
ADASYNGenerates more points where minority is hardest to learnUneven minority density
SMOTE-NCHandles mixed numeric and categorical featuresTabular data with categories
SVM-SMOTEUses support vectors to locate the boundaryData where support vector machines work well
SMOTE-Tomek and SMOTE-ENNOversample, then remove ambiguous pairsNoisy data with class overlap
Common SMOTE variants

Plain SMOTE assumes continuous numeric features. Applying it after one-hot encoding yields fractional category values such as 0.37, which correspond to no real category; SMOTE-NC or SMOTEN avoid this by assigning the most frequent neighbor category instead.

How SMOTE compares with other imbalance strategies

SMOTE is one option among several for class imbalance, and it is often not the strongest one for modern ensemble models. Class weighting, threshold tuning and undersampling address the same problem without inventing data.

StrategyMechanismMain drawback
SMOTESynthesizes minority pointsCan create unrealistic samples
Random oversamplingDuplicates minority rowsOverfitting to repeated points
Random undersamplingRemoves majority rowsDiscards useful information
Class weightsRaises the loss for minority errorsNeeds a weighted learner
Threshold tuningMoves the decision cutoffRequires calibrated probabilities
Imbalance strategies compared

With gradient boosting and random forest models, empirical comparisons frequently find that class weights plus threshold tuning match or beat SMOTE, while avoiding its extra preprocessing step. SMOTE tends to add more value for weak or distance-based learners such as logistic regression and k-nearest neighbors.

Applying SMOTE correctly in a pipeline

The single most important rule is to apply SMOTE only inside the training fold. Oversampling before the train-test split or before cross-validation leaks information, because synthetic points built from test records end up in training, and reported scores become optimistically biased.

  • Split the data first, then fit scaling and SMOTE on training folds only.
  • Use a pipeline object that resamples during fitting but never during prediction.
  • Evaluate with precision, recall, F1 and the precision-recall curve, not accuracy.
  • Tune k and the sampling ratio together with model hyperparameter tuning.

The decision table below helps choose whether SMOTE is a reasonable first step for a given situation.

SituationRecommended choiceReason
Numeric features, simple modelTry SMOTEFills sparse minority regions
Tree ensemble, large dataClass weights firstCheaper and often as effective
Mostly categorical featuresSMOTE-NC or SMOTENAvoids invalid category values
Very high-dimensional dataAvoid plain SMOTENeighbors lose meaning
Fewer than about 10 minority samplesCollect more dataToo few seeds to interpolate
When to use SMOTE

Limitations and common mistakes with SMOTE

SMOTE has well-known limitations that experienced practitioners check for before trusting results. Its interpolation assumes that the space between two minority points is also minority territory, which fails when the minority class is split into separate clusters with majority samples between them.

  • Noise amplification: a mislabeled minority point seeds further wrong samples.
  • Class overlap: synthetic points can land inside majority regions and blur the boundary.
  • Curse of dimensionality: in hundreds of dimensions, nearest neighbors are nearly equidistant.
  • Probability miscalibration: models trained on balanced data overestimate minority probability in production.
  • Not suitable for raw images or text, where linear interpolation rarely yields realistic inputs.

Because the training prior changes, predicted probabilities must be recalibrated or the threshold adjusted when the model faces the true class ratio. SMOTE also does nothing about concept drift, so a rebalanced model still needs monitoring after deployment.

A non-technical view

Imagine teaching someone to spot counterfeit banknotes when the practice pile contains a thousand real notes and only ten fakes. The learner may simply decide that every note is real, because that guess is almost always right. SMOTE fixes the lopsided practice pile by inventing new fake examples.

It does this carefully: it takes two similar fakes and creates a new one that sits somewhere between them, a blend of their features. The new examples are plausible, not copies, so the learner sees more variety. The catch is that blending only works when the in-between examples are realistic, and the invented examples must never be used to grade the learner.

A concrete example

A data team at a regional bank builds a model to flag fraudulent card transactions. Its training set contains 200,000 transactions, of which only 400 are fraudulent, a ratio of 1:500. A logistic regression trained on the raw data reaches 99.8 percent accuracy but catches only 22 percent of fraud cases.

The team standardizes the 30 numeric features, then applies SMOTE with k = 5 inside each cross-validation fold, raising the fraud class to 20 percent of the training fold. Evaluated on an untouched test set with the real 1:500 ratio, recall rises to about 70 percent while precision drops to an acceptable level for manual review. The team also recalibrates probabilities and compares the result against class weighting, which performs similarly; they keep SMOTE because it gave the most stable recall across folds.