Sample
A sample is the slice of data you actually get to look at, measure, and learn from—because collecting “everything” is usually impossible. It’s how we make informed guesses about a bigger world using a manageable amount of information.
What a sample really is
In statistics, a sample is a set of observations drawn from a larger population (the full group you care about). Each row in a dataset is often one sampled unit: a person, a house, a transaction, a patient visit. The goal is that patterns in the sample reflect patterns in the population—within some uncertainty.
Why sampling quality matters
A sample can mislead if it’s not representative. Common issues include:
- Sampling bias: you systematically miss certain kinds of cases (e.g., only surveying online shoppers).
- Small sample size: estimates bounce around more, increasing variance and widening confidence intervals.
- Non-independence: repeated measurements from the same source can “double count” evidence.
Everyday examples
- House prices: you sample recent sales to estimate the average price in a city.
- Exam scores: you sample a subset of students to estimate how a new teaching method performs.
- Medical measurements: you sample patients from clinics to estimate a biomarker’s typical range.
Where it shows up in AI/ML
In machine learning, your training data is a sample of the real-world situations the model will face. If the sample differs from deployment reality, you get distribution shift and performance drops. Practices like train/validation/test splits, cross-validation, and bootstrapping are ways of re-sampling or partitioning to estimate generalization and uncertainty. Libraries like scikit-learn implement these ideas directly (e.g., train_test_split, KFold).
Sample is a subset of observations drawn from a larger population, used to estimate population properties and train or evaluate models when full data are unavailable or too costly. Statistical inference and generalization in ML depend on how representative the sample is and how it was collected (e.g., random vs. biased sampling). Example: training a classifier on 50,000 labeled images sampled from millions to approximate real-world performance.
Imagine you want to know what everyone in a city thinks about a new park, but you can’t ask every single person. Instead, you ask a smaller group and use their answers to guess what the whole city thinks. That smaller group is a sample.
In statistics and machine learning, a sample is the set of data points you actually collect or use—like a list of customer purchases, a batch of photos, or a table of patient records. We study the sample to learn patterns and make predictions about a bigger group (often called the “population”) that the sample is meant to represent.