"Statistics," "data science," and "artificial intelligence" get tossed around as if they're the same thing, or as if they're competing. Neither is true. They're three teammates, each with its own job, that together turn raw data into real-world intelligence.
If the What Is Statistics? chapter answered "what is statistics?", this chapter answers "how does statistics connect to the data science and AI everyone's talking about?" By the end you'll have a mental map you can hang every later chapter on.
Meet the Three Fields
Start simple, here's what each one actually does, in plain language:
Statistics
Makes sense of data. The math of collecting, summarizing, and drawing trustworthy conclusions from data, and measuring how sure we can be. It's the foundation everything else stands on.
Machine Learning & AI
Learns patterns to predict. AI is the broad goal of machines acting "smart"; machine learning is how we get there, letting algorithms learn from data instead of being hand-coded.
Data Science
Delivers the whole solution. The end-to-end practice of turning messy real-world data into value, using statistics, machine learning, programming, and domain knowledge together.
AI is the big umbrella (any machine doing tasks that seem intelligent). Machine learning is the most successful slice of AI today, and deep learning (neural networks) is a slice of that. Bigger circle to smaller circle.
So which job does each field map to? Roughly:
Data Analyst
Describes and reports what already happened. Dashboards, summaries, "what were last quarter's sales?"
Data Scientist
Explains and predicts, end to end. Builds models and answers "what will happen, and why?"
ML Engineer
Productionizes and scales models so they run reliably for real users.
Modern machine learning also leans on optimization, computer science and algorithms, and linear algebra. Statistics is the foundation we focus on, but it works alongside these other tools.
How They Fit Together
Two pictures make the relationships click. First, AI, ML, and deep learning are nested, each inside the last:
Second, the fields compose like a recipe. Add ingredients and you move from raw statistics all the way up to full data science:
Each row builds on the result of the row above it, and statistics is the foundation the whole stack rests on, from basic analytics all the way up to modern AI and large language models.
Data science is often drawn as the overlap of three skill sets, where statistics, programming, and domain expertise meet:
How They Complement Each Other
This is the key point. These fields aren't rivals; they're complementary, each picking up where the others leave off. The clearest example is explain vs. predict:
Goal: explain & understand relationships in data.
- "Is studying linked to better grades?"
- Outputs: averages, correlations, p-values, confidence
- Prizes interpretability, knowing the why
Goal: predict outcomes for new, unseen cases.
- "Will this student pass the final?"
- Outputs: predictions, accuracy, recommendations
- Prizes performance, getting the answer right
And data science is the conductor: it takes the explaining power of statistics and the predicting power of ML, wraps them in clean data, code, and business context, and ships a result that matters. Same data, three complementary jobs:
π Statistics
Understand the data and whether a pattern is real.
π€ Machine Learning
Turn that pattern into predictions at scale.
π Data Science
Deliver it as a working, valuable product.
Statistics gives you trust, machine learning gives you prediction, and data science gives you delivery, remove any one and the result is weaker.
How AI Uses Statistics
Look inside any AI system and you'll find statistics at every stage:
Data Collection
Statistics helps gather the right data, from the right sources, in the right amounts.
Pattern Discovery
Statistical methods find the trends, relationships, and structure hidden in the data.
Prediction & Decisions
Statistical models turn those patterns into predictions and smart choices.
Continuous Improvement
Statistics measures performance so the system learns and gets better with more data.
Spotlight: LLMs & ChatGPT
You can't talk about AI today without large language models (LLMs), the tech behind ChatGPT, Claude, and Gemini. They write essays, answer questions, summarize, and code. They feel magical. But underneath, an LLM is a giant statistics machine.
That's it. The "intelligence" comes from doing this astonishingly well, having learned those probabilities from a huge amount of text. (Technically it predicts the next token, a word or word-piece, and it learns from training data measured in trillions of words.) The idea in one picture:
Where do those probabilities come from? Training, the model reads enormous amounts of text and adjusts billions of internal numbers so its next-word guesses match reality as closely as possible. That's the same statistical idea from the What Is Statistics? chapter: estimating parameters from data so the observed data is most likely (maximum likelihood).
Probability at the core
Every answer is sampled from a probability distribution over words. "Creativity" is just how adventurously it samples.
Trained by statistics
Training minimizes prediction error (a likelihood-based loss). Quality is even scored with a statistic called perplexity.
An LLM isn't looking up answers. It's a probability model of language, built with statistics and scaled to billions of parameters. Set the scale aside and you're left with the very ideas in this book: probability, data, and learning parameters from examples.
Beginner Vocabulary
A few words you'll meet everywhere in data science and AI, worth knowing now:
Dataset
A collection of data, usually a table of rows (examples) and columns (attributes).
Feature
An input column the model learns from, e.g., a house's size or number of bedrooms.
Label (target)
The thing you want to predict, e.g., the house's price.
Model
A learned pattern that maps features to a prediction.
Training
The process of fitting a model to data so it captures the pattern.
Algorithm
The recipe/procedure used to learn the model from data.
Prediction
The model's output for a new, unseen example.
Data cleaning
Fixing missing, wrong, or messy values before analysis.
Pipeline
The full sequence of steps from raw data to a useful result.
Bring it to life in Python
The companion notebook shows all three fields in action, summarizing data (statistics), a mini data-science pipeline, a "learn-to-predict" ML demo, explain-vs-predict, and AI improving with more data.
View opens the rendered notebook instantly (no setup). Open in Colab runs &
edits it live in your browser. To run locally, install numpy, pandas, matplotlib
and launch jupyter notebook.
π Key Takeaways
- βThree teammates: statistics makes sense of data, ML/AI learns patterns to predict, and data science delivers the end-to-end solution.
- βAI β ML β deep learning, nested circles, with statistics as the math foundation beneath them all.
- βThey compose like a recipe: statistics + code + data β analytics β + ML β machine learning β + domain knowledge β data science.
- βExplain vs. predict: statistics asks why, machine learning asks what next, complementary, not competing.
- βAI runs on statistics at every step: collecting data, finding patterns, predicting, and improving.
- βLLMs (ChatGPT & friends) are giant statistical models that predict the next word, statistics scaled to billions of parameters.
Practice Challenges
Five short, beginner-friendly challenges, at least one in each field. Try them with pencil and paper or in Python. Keep it simple; the goal is to build intuition.
Statistics Β· Summarize the week
Daily steps for a week: [5000, 7000, 8000, 6000, 10000, 9000, 7000].
Find the mean and the range (max β min).
Statistics Β· Explain or predict?
Label each as explain (statistics) or predict (ML): (a) "Is sleep linked to test scores?" (b) "Will this customer cancel next month?" (c) "What was our average revenue last quarter?"
Data Science Β· Clean, then summarize
Survey ages: [22, 25, (missing), 30, 28]. (a) What cleaning step is needed?
(b) Find the mean of the known ages.
Machine Learning Β· Features vs. label
A model predicts a house's price from its size, bedrooms, and age. Which are the features (inputs) and which is the label (target)?
All three Β· Who does what?
A streaming service. Match each task to Statistics, Machine Learning, or Data Science: (a) report average watch time; (b) predict the next show a user watches; (c) build the whole recommendation product.
A fully-worked solutions notebook walks through all five challenges in the same visual style, try them yourself first, then compare.
Quiz: Test Yourself
Nine quick questions to lock in the big picture. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.