Start here: the data science process

Every data project goes through the same seven stages, and every lab on this site practices some of them. For each stage: what it is, the mistake I see most, the concept video, the Python videos, the labs that practice it, and one outside resource worth your time. Use it to place what you are doing this week, and later to plan a project of your own.

1Question 2Data 3Clean 4Explore 5Model 6Evaluate 7Communicate
Stage 1

Question

Write one sentence that says what you want to know and who will act on the answer. Decide early whether the job is prediction (what will happen) or inference (what causes what), because the two are built and checked differently. The mistake I see most is opening the data first and letting whatever happens to be in it choose the question.

Stage 2

Data

Find out where the rows came from, who is in them, who is missing, and what one row means. A large sample is no protection when the people in it chose to be there. Students tend to trust a tidy-looking file; ask how it was made before you ask what it says.

Stage 3

Clean

Fix the types and the dates, decide what to do about missing values, join tables without doubling rows, and treat an outlier as a decision rather than a nuisance. Most of the hours of a project go here, and so do most of the quiet errors. The mistake is cleaning with the test set in view, so that information from the data you will score on leaks into the data you train on.

Stage 4

Explore

Look before you model: summary numbers, a histogram of everything, scatterplots of the pairs you care about, and a check of the sample against what you know about the population. Four datasets with the same means and the same correlation can look nothing alike. The mistake is reading a causal story off a scatterplot that three different stories could have made.

Stage 5

Model

Pick the simplest method that answers the question, fit it, and know what each number it prints means. For an effect, that is a design that deals with confounding; for a prediction, a model whose complexity matches how much data you have. The mistake is adding predictors or controls because the fit improves, when some of them create the very bias you were trying to remove.

Stage 6

Evaluate

Ask how wrong you could be: a standard error or an interval for an estimate, a score on held-out data for a prediction. The in-sample fit always flatters you. Students report an R-squared and a p-value and stop; report the uncertainty, the test on data the model never saw, and the result that would have changed your mind.

Stage 7

Communicate

Turn the result into something another person can act on: one chart that does not mislead, one number with its interval, one paragraph in plain words, and code that runs again from the top. The mistake is a notebook that only works in the order you happened to click it, and a chart whose axis does the arguing for you.