AI Act (EU)
The AI Act is the European Union regulation that governs artificial intelligence. It sorts AI systems by risk and places obligations on anyo...
Read definitionData sampling means working with a subset of a dataset instead of all of it, either to move faster and cheaper or to estimate a property of the whole. It only works when the sample is representative, so how you pick the rows matters as much as how many you pick.
Data sampling means working with part of a dataset instead of all of it. You take a subset either to move faster and cheaper, or to estimate a property of the whole, such as the share of orders that are late or the average basket size.
Analysts reach for a sample during data profiling, while testing query logic on a smaller volume, or when exploring a machine learning dataset before training on everything. A filter keeps the rows that meet a condition; a sample keeps a subset meant to stand in for the whole.
Four methods cover almost all day-to-day work.
Simple random. Every row has the same chance of being picked. It is the default when the data has no structure you need to protect.
Stratified. You split the data into groups first, then sample inside each group so the proportions are preserved. Reach for it when a subgroup is small, such as a 2 percent churn class, so it does not disappear from the sample. This is why stratified splits matter for class imbalance and for cross-validation.
Systematic. You take every nth row, for example every hundredth. It is quick, but only safe when the order of the rows carries no hidden pattern that lines up with your interval.
Cluster. You divide the data into natural groups, such as stores or regions, then sample whole groups. It is cheaper when each unit is expensive to reach, at the cost of some accuracy.
The number of rows is the easy part. Representativeness is the hard part, and it is where most sampling goes wrong.
Convenience sampling is the usual trap: you grab the first 10,000 rows, or one region, or one month, because it is quickest. That subset bakes in whatever pattern sits at the front of the table. Those first rows may all fall in January, one region may skew older, and every conclusion then inherits that skew. This is a direct source of bias, and it drags down data quality in everything you build on the sample.
Before you trust a sample, compare a few distributions against the full dataset. Does the mix of countries, dates, or customer types roughly match? If it does not, the sample is answering a different question than the one you asked.
Sampling is the right tool for exploration: profiling a new source, sanity-checking a transformation, or spotting outliers before you commit compute to the whole thing.
It is the wrong tool the moment the number has to be exact. Financial totals, tax figures, and compliance or audit reporting need every row, not an estimate. A sampled revenue figure that is 3 percent off is not a smaller version of the truth, it is a wrong number.
Query engines make this concrete. BigQuery reads sampled data a block at a time with TABLESAMPLE SYSTEM (10 PERCENT), so the exact fraction of rows varies and a table under about 1 GB is read in full anyway. Spark treats the fraction in its sample method as a per-row probability, not an exact count. Both are fine for a quick look, and both return a slightly different set each run unless you fix a seed. Neither belongs in a figure you report to the tax office.
The AI Act is the European Union regulation that governs artificial intelligence. It sorts AI systems by risk and places obligations on anyo...
Read definitionAI literacy is the knowledge and judgement people need to use AI responsibly: understanding what a model can do, checking its output, protec...
Read definitionAnomaly detection automatically flags data points, events, or patterns that do not fit normal behaviour. It can catch odd invoices, machine ...
Read definitionArtificial intelligence is technology that teaches computers to learn, reason, and make decisions from data instead of following hand-writte...
Read definitionBias in AI is a skew that creeps into models through data, algorithms, or human choices. It is not always harmful, but it has to be managed ...
Read definition
A step by step guide on how you can create an event log for process mining.
AI won’t make people jobless. It will change how we work and create new kinds of jobs. See what history teaches us about how technology resh...