Stratified sampling
Stratified sampling is a method that divides a population into defined subgroups and samples from each to control their representation.
Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI
A sampling method that divides a population into subgroups and samples from each subgroup.
- How it is used
- Uses stratification to direct annotation toward diverse or important groups that might otherwise be overlooked.
- How deep it goes
- Explains subgroup quotas and within-group selection with worked examples, while leaving demographic implementation without separate code.
- Examples
- Illustrates confidence intervals in object detection, weighted labels in semantic segmentation, and label groups in part-of-speech tagging.
- What you can do after
- Practice selecting quotas and sampling methods for demographic, confidence, or label groups.
Machine Learning System Design
Stratification is a sampling technique that divides data into groups and controls the amount selected from each group.
- How it is used
- Supports validation design, subgroup representation, and efficient sampling for large, imbalanced, or duplicate-heavy datasets.
- 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 you can do after
- Apply stratification by defining subgroups and controlling each group’s contribution to training or test data.
Read how Machine Learning System Design explains stratified sampling →
Build AI Drug Discovery Pipelines
Stratified sampling partitions data while preserving specified class or label distributions across the resulting subsets.
- How it is used
- Uses representative train-test splits for multilabel CYP inhibitor prediction.
- How deep it goes
- Explains label preservation and demonstrates implementation, but stops short of mathematical derivation.
- Examples
- Uses five CYP inhibitor labels, 4,805 shared molecules, and IterativeStratification.
- What you can do after
- Apply it via IterativeStratification to construct representative multilabel training and test sets.
Read how Build AI Drug Discovery Pipelines explains stratified sampling →
Inside Deep Learning: Math, Algorithms, Models
A sampling method that preserves class proportions across data splits or samples.
- How it is used
- Preserves class proportions when creating train/test splits to reduce misleading impressions of model performance.
- How deep it goes
- Explains preserving class ratios and why it matters, but leaves class-imbalance remedies largely untreated.
- Examples
- Illustrates 99-to-1 class ratios, a cancer-prediction scenario, and a language-name classifier split.
- What you can do after
- Apply stratified splitting by selecting a test set that preserves each class’s dataset proportion.
Read how Inside Deep Learning: Math, Algorithms, Models explains stratified sampling →
Also covered in
- LLM Customization and Fine-TuningIn early access (MEAP)
- Transformers in Action
- Financial AI in Practice
- Evaluating AI SystemsIn early access (MEAP)
- Knowledge Graphs and LLMs in Action
- Microsoft Azure in Action
- Designing AI AgentsIn early access (MEAP)
What to know first
- accuracyAccuracy is the degree to which a result agrees with a specified truth, reference, or criterion, commonly measured as the proportion of evaluated predictions that are correct.
- f-scoreAn F-score is a classification metric that combines precision and recall through a weighted harmonic mean; F1 weights them equally.
- precisionPrecision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
- recallRecall is the proportion of all relevant or actual positive items that a system successfully retrieves or correctly identifies.
Related concepts
- samplingkind of · Sampling is a procedure for selecting items from a collection or generating outcomes from a probability distribution according to a specified rule.
- dataset splitused by · A dataset split is the division of a dataset into distinct subsets assigned different purposes, such as training, validation, or evaluation.
- diversity-based samplingimplements · Diversity-based sampling selects examples to represent variation or cover underrepresented regions of a candidate set or feature space.
- real-world diversityaddresses · The variation in characteristics and experiences across people or groups in the population relevant to a data or machine learning task.
- active learning strategyuses · A method for selecting items to label during active learning.
- labeluses · A label is a target value, category, or reference annotation associated with an example for learning, prediction, or evaluation.
Questions about stratified sampling
What is stratified sampling?
Stratified sampling is a method that divides a population into defined subgroups and samples from each to control their representation.
Which Manning books explain stratified sampling?
Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI, Machine Learning System Design, Build AI Drug Discovery Pipelines and Inside Deep Learning: Math, Algorithms, Models.
What should I know before learning stratified sampling?
Manning books that teach stratified sampling usually introduce accuracy, f-score, precision and recall first.
What is stratified sampling a kind of?
Stratified sampling is a kind of sampling. Sampling is a procedure for selecting items from a collection or generating outcomes from a probability distribution according to a specified rule.
What is stratified sampling also called?
Stratified sampling is also called stratification.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



