🧪  Subsampling

Subsampling#

Selecting a representative subset of rows, often to speed up training or to rebalance class frequencies.

Important

✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.

What it is#

Subsampling means working with a subset of the original data — or, for a signal, with fewer samples per second — instead of the whole thing. It is used for three broad reasons: to make training and analysis faster, to rebalance classes, and (in signal processing) to lower a signal’s sampling rate.

In machine learning#

When a dataset is very large or heavily imbalanced, subsampling trades a little information for a lot of speed or balance:

  • Random subsampling — draw a random subset of rows (like bootstrapping, but without replacement).

  • Undersampling the majority class — shrink the over-represented class so it no longer dwarfs the minority class.

  • Cross-validation subsampling — select different subsets per fold to estimate performance.

For example, a 1,000,000-row dataset might be cut to a 100,000-row subsample so models train in a fraction of the time.

In signal processing#

Here subsampling is downsampling — reducing the sampling rate of a signal, for instance taking 44.1 kHz audio down to 22.05 kHz. The catch is aliasing: high-frequency content that the lower rate can no longer represent folds back and masquerades as lower frequencies. The remedy is to apply a low-pass filter first, removing those high frequencies before dropping samples.

Trade-offs#

Advantages:

  • Faster training and inference, since there is simply less data.

  • Lower storage and compute cost.

  • Applied to the majority class, it helps balance class proportions.

Disadvantages:

  • Information loss — discarding data can lower accuracy.

  • If the draw is not stratified, it can shift the class distribution by accident.

  • For signals, dropping samples without filtering injects aliasing noise.

Examples#

Subsample a dataset with scikit-learn:

from sklearn.utils import resample

X_sub, y_sub = resample(X, y, n_samples=10_000, replace=False, random_state=42)

Downsample a signal with SciPy (its resample applies an anti-aliasing filter internally):

import scipy.signal as sps

signal_sub = sps.resample(signal, len(signal) // 2)

How it relates to nearby terms#

Term

Context

What it does

Undersampling

Imbalanced classification

Removes majority-class samples

Oversampling

Imbalanced classification

Adds minority-class samples

Subsampling (ML)

General

Takes a subset for speed or balance

Subsampling (DSP)

Signals

Lowers the sampling rate (downsampling)


Theme: Imbalanced Learning & Resampling  ·  All terminology



See also

Source article Adapted (context, re-expressed) in our own words from: Subsampling (insightful-data-lab.com).

Tags: purpose: reference topic: terminology level: intermediate