What is Oversampling?

A fraud detection team trains a model on transactions where confirmed fraud cases are rare. The first model labels almost every transaction as normal.

Oversampling is a data preparation technique that increases the share of rare classes in a training dataset, by duplicating existing examples or creating synthetic ones, so a model sees enough of the cases it must recognize; the team still evaluates the model on original data that keeps the real class balance.

Oversampling is meant for a dataset that is large overall but has few examples of the classes the task depends on. In CUBIG’s insurance conversation project (internal test, January 2025), the team worked with 64 intent categories and 6,874 cleaned conversation records, and some categories had fewer than 50 examples.

In that CUBIG test, the team trained one model on the original data and one on data with the scarce categories supplemented, kept model settings the same and scored both on the same 687 original conversations. Weighted F1, an overall measure of classification performance, rose from 58.55% with the original data to 88.55% with the supplemented data, according to CUBIG’s published write-up of that internal test. Weighted F1 does not show that every category improved equally. The write-up also does not name the supplementation method, so the result does not measure what oversampling alone would do.

Wikipedia’s entry on oversampling and undersampling describes them as “techniques used to adjust the class distribution of a data set” and names SMOTE as the most common technique. Chawla, Bowyer, Hall and Kegelmeyer introduced SMOTE in the Journal of Artificial Intelligence Research (2002): “Our method of over-sampling the minority class involves creating synthetic minority class examples.” The paper also tests over-sampling the minority class together with under-sampling the majority class.

How does oversampling work?

  • Random duplication: the team copies existing examples from the rare class.
  • SMOTE: the team creates synthetic examples of the rare class from existing ones.
  • Combined sampling: the team oversamples the rare class and undersamples the common class.

The AI team chooses a method by the data and the task: random duplication is simple but can lead the model to memorize repeated rows. SMOTE adds variety but can create examples that do not occur in real use, so the team checks the synthetic rows against the real cases.

How is oversampling different from undersampling?

Oversampling adds examples of the rare class. Undersampling removes examples of the common class. Undersampling keeps every remaining example real but throws away data the model could have learned from; oversampling keeps all the data but repeats or imitates rare examples. Teams sometimes combine the two, as the SMOTE paper tests.

When can oversampling mislead an evaluation?

Oversampling before the train/test split can put copies or near-copies of training examples into the test set. Test scores can then look better than the model will perform on new cases.

  • Oversample only the training data, after the train/test split.
  • Evaluate on original, untouched data.
  • Check results per class, not only overall accuracy.
  • Review false positives and false negatives on the rare class.

CUBIG’s DTS (Data Enablement for AI) is a product for teams whose data is thin in the cases a task depends on: it fills in scarce cases, adjusts skewed distributions and prepares data that is hard to use as-is for a specific AI task. DTS can be adopted on its own.

Related entries: SMOTE, imbalanced dataset and class imbalance.

Frequently asked questions

Why do teams oversample data?

Teams oversample when some classes have too few examples for a model to learn their patterns. Adding examples gives the model more exposure to rare cases, but the method and the evaluation still need review.

Does oversampling always improve a model?

No. Duplicated examples can make a model memorize the training data, and synthetic examples can add patterns that do not occur in real use. Teams compare approaches on the same original test data and check each class.

Should a team oversample its test data?

No. The test data stays untouched. Oversampling belongs in training, after the team separates the test set, so the evaluation reflects the class balance the model will meet in real use.