Exploratory data analysis
Plots before models: distributions, outliers, and the summary statistics that lie about them.
Four datasets can share the same mean, the same variance, and even the same correlation to two decimal places while being utterly different — Anscombe showed this in 1973 and the lesson has only grown sharper since. The point is not that summary statistics are useless. It is that they are lossy compressions, and compressions are only safe once you know what they threw away.
Exploratory data analysis is the discipline of looking before you compress. Before a single model is fit, you want to know the shape of each variable, how they move together, which points are outliers, and which missingness patterns might be telling you something. EDA is not "quick and dirty" — it is where most real discoveries and most data bugs are found.
Two numbers, two summaries
The mean is dragged around by every value, including the extreme ones; the median only cares about the middle. In a right-skewed distribution — incomes, wait times, request latencies — the mean sits above the median and no single number describes a typical case. When mean and median disagree, that disagreement is information.
Play with the workbench below. The mean chases the tail while the median holds its ground; the box plot exposes outliers the histogram buries; and the bimodal option shows two modes that a single mean would happily average into a value that appears nowhere in the data.
Same dataset, three views — change the shape and watch the summary statistics move
histogram · 16 bins · n = 180
box plot · whiskers extend to 1.5 × IQR, 2 outliers beyond
Distribution
- mean
- 49.66
- median
- 48.88
- Q1
- 42.11
- Q3
- 57.21
- IQR
- 15.10
Note how the mean chases the tail while the median holds its ground in the skewed case, and how the bimodal case shows two modes a single summary statistic would hide. The generator uses a fixed seed so the numbers are reproducible, but they are synthetic — real EDA starts by plotting the data you actually have.
The five-number summary and the box plot
For a sorted sample, the five-number summary is the minimum, the first quartile , the median , the third quartile , and the maximum. The interquartile range is
the spread of the middle half of the data. The box plot draws the box from to with a line at the median, and marks points beyond the fences
as candidate outliers. The is a convention, not a law: for a normal distribution it flags roughly 1 in 140 points, so a handful of flags is expected, while a flood of them means the distribution is heavy-tailed and perhaps should be transformed.
Why the histogram depends on the bin width
A histogram estimates a density by counting points per bin. Its appearance depends on the bin width : too wide and real modes merge, too narrow and randomness looks like structure. The bias-variance trade-off is explicit — the expected count in a bin of width near density is approximately , so the bin's standard error grows as shrinks. There is no single correct width; the honest move is to try several and only believe a feature that survives.
Explore on training data, not everything
Running EDA on the full dataset and then choosing features, thresholds, or a model based on what you saw is a subtle form of leakage. Any decision informed by the test set contaminates it. Reserve the split before you start making choices, and if you must explore globally, keep the decisions general.
Missingness is data too
A missing value is a fact about the process that produced the row. If income is blank more often for one group, dropping those rows silently changes the population your model describes. Always ask: is it missing at random, missing because of an observed variable, or missing because of the value itself? The answer determines whether imputation is safe, and no amount of clever filling fixes a missingness mechanism you refused to name.
Illustrative vs real
The distribution generator in the artifact is synthetic and seeded so numbers are reproducible. Real EDA starts from data you did not design, with units, join keys, and collection quirks that no toy can imitate. The statistics computed here — quartiles, fences, counts — are exactly the ones you would use; only the provenance of the numbers is simplified.
Check yourself
Eduspheria wiki · Data, MLOps & Deployment, Data science foundations
0 / 4 answered
From the exam paper
Modeled on NITJ AI-505, End-Sem December 2024
0 / 4 answered
Where next: statistical inference — turning a sample into a claim about the population, with an honest error bar attached.