liveBook · Manning

Stratified sampling

As explained in Machine Learning System Design

Stratification is a sampling technique that divides data into groups and controls the amount selected from each group.

Stratified sampling divides data into groups and controls how much data comes from each group. It helps datasets reflect important subgroups rather than simply mirroring the largest population. section 6.3 section 6.4

Use stratification when dataset composition could distort model development:

  • Balance customers from different markets, such as countries X and Y, across training and test datasets. section 6.3
  • Reduce the influence of imbalanced or duplicate-heavy datasets by limiting data selected from defined groups. section 6.4
  • Prioritize groups deliberately when equal representation is not appropriate, such as favoring fresh data over older temporal groups. section 6.4

Expanding from country X to country Y

A company that collected mostly customer data from country X must represent both X and newly entered country Y in its training and test datasets to pursue comparable service and model accuracy. section 6.3

How Machine Learning System Design covers it

How deep it goes
Defines group-based sampling and selection priorities, but does not detail algorithms or validation procedures.
Examples
Uses cross-country customer representation and fresh-versus-old temporal groups as concrete sampling cases.
What it assumes
Assumes familiarity with training and test datasets while defining subgroup selection from basic sampling concepts.
What you can do after
Apply stratification by defining subgroups and controlling each group’s contribution to training or test data.
How it connects
Connects stratified sampling with validation design, algorithmic bias, imbalanced data, duplicates, and temporal data.

Also explained in

Compare how 2 books explain stratified sampling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.