liveBook · Manning

Resampling

As explained in Financial AI in Practice

Changing a dataset's composition by sampling its observations, often to address class imbalance.

A payment-fraud detector may see thousands of legitimate transactions for every fraudulent one. Resampling changes the composition of its training data so the rare fraud class has more influence. Without an imbalance strategy, a model can achieve high overall accuracy by approving nearly everything while missing fraud. section 8.1.1

Two common approaches change the class balance in opposite ways:

  • Oversampling increases representation of the minority fraud class. SMOTE generates synthetic fraud examples. section 8.1.1
  • Undersampling reduces representation of the majority legitimate class by removing transactions. section 8.1.1

Keep resampling inside the modeling pipeline, after partitioning the data. Applying it before cross-validation can let synthetic fraud examples contaminate validation folds and inflate performance estimates. Leave the test set untouched at its original class balance. Cost-sensitive learning is a separate option: it increases the penalty for missed fraud instead of changing the dataset. section 8.2.2 section 8.1.1

Check the fraud-detection split

A stratified 70/30 split retains approximately 0.1725% fraud in both training and test sets. Resample only for training; evaluate against the unchanged test set using precision, recall, and F1 rather than accuracy alone. A model that approves every transaction could score 99% accuracy while catching no fraud. section 8.2.2 section 8.1.1

How Financial AI in Practice covers it

How deep it goes
Defines oversampling and undersampling, names SMOTE, and warns about cross-validation contamination without providing a resampling implementation.
Examples
Uses rare payment fraud and a stratified split retaining roughly 0.1725% fraud in both training and test sets.
What it assumes
Assumes labeled fraud and legitimate transactions; defines the imbalance problem and the basic resampling options.
What you can do after
Operate/configure it within a modeling pipeline while preserving an untouched, imbalanced test set for evaluation.
How it connects
Connects resampling to supervised learning, class imbalance, SMOTE, cost-sensitive learning, cross-validation, and precision and recall.

Also explained in

Compare how 3 books explain resampling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Financial AI in Practice. The section links point to the parts of the book it draws on.