Understand the nested map of AI, machine learning, deep learning, and where agents fit.
AI is the broad goal of making machines do smart things; machine learning is the subset that learns from data; deep learning is the subset of ML that uses many-layered neural networks. They are nested circles, not three competing things.
AI is the broad goal; ML is the data-driven subset; deep learning is the neural-network subset of ML.
Why this matters: It matters because the words are used interchangeably in marketing, which hides what each one actually does.
Why this distinction exists: every product now claims to use "AI." That word covers everything from a hand-written if/else rule to a billion-parameter network. If you can place a system in the right circle, you instantly know what data it needs, how it can fail, and whether you can explain its answers.
The single most useful picture of AI vs ML vs Deep Learning is three circles, one inside the next.
So every deep-learning system is machine learning, and every machine-learning system is AI — but not the reverse. A thermostat rule is AI but not ML; spam filtering with hand-picked features is ML but not deep learning.
The same task — flagging spam email — can live in any of the three circles:
Same goal, three very different answers to "how much data, how explainable, how expensive."
Slide inward to see how each circle narrows the definition — broad goal, then learning-from-data, then neural networks.
If a human wrote every rule by hand, it is but not machine learning. If it improves from examples, it is ML.
If you fed it hand-chosen signals (word counts, pixel averages), it is classic . If a neural network learned the features from raw input, it is deep learning.
"This is AI, specifically ML, specifically deep learning" — or stop at the first circle that fits. The narrowest true label tells you the most.
Technically, the boundaries are about where the function comes from. Rule-based AI: a human encodes the function f(x). Classic : an algorithm fits f(x) to data using human-engineered features. Deep learning: a network learns both the features and f(x) end-to-end.
The circles differ in who supplies the logic. Rule-based AI gets it from a human. Classic ML learns it from data using features a human chose. Deep learning learns the features and the logic together. The shared engine of both ML kinds is: minimize a loss, then check that it generalizes.
The dividing line is who writes the logic: a human, a learning algorithm over chosen features, or a deep network over raw data.
Why this matters: It matters because the mechanism predicts where each approach shines and where it falls over.
Both classic and deep learning run the same basic loop to build a :
The difference is what gets adjusted. Classic ML adjusts weights over features you chose. Deep learning stacks many layers and adjusts them all, so the network discovers useful features from raw input by itself.
Goal: predict a house's price.
Both shrink a ; only the deep model invents its own features.
The begins with random settings and predicts a label for one example — usually badly.
The function turns 'how wrong' into a single number the algorithm can shrink.
After many nudges, hold out data the model never trained on and confirm it still scores well — that is , the only success that counts.
Before deep learning, the hard part of was feature engineering — humans hand-crafting the inputs. Deep networks replaced that with representation learning: each layer composes the previous layer's outputs into higher-level features, so raw pixels become edges, then shapes, then objects, with no human in the loop.
Knowing the circles is only useful if it changes what you build. The real decision is rarely 'AI or not' — it is 'classic ML or deep learning', and it turns on how much labeled data you have, whether you must explain the answer, and what compute you can afford. The default should be the simplest model that meets the need.
A practical choice between a small, explainable model and a large, data-hungry deep model.
Why this matters: It matters because reaching for deep learning by default wastes data, money, and debuggability.
Decision this forces: Pick the narrowest circle that solves the problem: rule-based AI, classic ML, or deep learning.
It is tempting to reach for deep learning because it is the most powerful circle. But power you do not need is cost you do not need: more labeled data, more compute, and far less ability to explain the answer.
Three questions settle most choices:
If a handful of hand-written rules solve it, you are done — that is with no training data to collect and nothing to retrain.
If patterns are too messy for rules but your data is tabular and modest, a classic model is usually faster to ship and easier to debug.
Raw images, audio, or language at scale — and enough labeled data — is where deep learning's advantage finally pays for its cost.
| Option | Data it needs | Interpretability | Best fit | When to choose | Cost | Complexity |
|---|---|---|---|---|---|---|
| Rule-based AI | None to train — a human writes the logic. | Fully transparent; you can read every rule. | Stable problems with a few clear conditions. | Use when a handful of rules already capture the logic. | Low | Low |
| Classic ML | Modest, often tabular, with chosen features. | Often readable; you can inspect feature weights. | Messy patterns over structured data. | Use when rules fail but data is modest and you want explainability. | Medium | Medium |
| Deep learning | Large labeled sets, often raw and unstructured. | Hard to explain why it decided what it did. | Images, audio, language at scale. | Use when input is raw perception data and you have lots of it. | High | High |
Deep learning's accuracy is not free: it shifts work to data labeling, compute, and tuning, and it makes failures harder to diagnose because the learned features are opaque. A classic model that is 2% less accurate but fully explainable is often the better production choice.
Eight lines train an actual machine-learning model: split the data, fit a classifier, and score it on data it never saw. This is classic ML — not deep learning — and it makes the training loop from module 2 something you can run.
A minimal scikit-learn classifier that turns the concept into code you can run.
Why this matters: It matters because seeing one work makes the AI/ML/deep-learning boundary tangible.
The training loop from module 2 is only a few lines in practice. You split your data so you can test honestly, fit a on the training half, and then score it on the half it never saw.
That last step is the whole point: a high score on data the model already memorized proves nothing. A high score on held-out data is .
The model below is logistic regression — a classic algorithm with no neural-network layers. It is squarely inside the ML circle and outside the deep-learning circle.
If you swapped it for a multi-layer neural net on the same tiny dataset, you would add complexity and risk overfitting without gaining accuracy. The right circle here is the smaller one.
from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.datasets import load_iris X, y = load_iris(return_X_y=True) Xtr, Xte, ytr, yte = train_test_split(X, y, random_state=0) model = LogisticRegression(max_iter=200).fit(Xtr, ytr) print(model.score(Xte, yte)) # accuracy on data it never trained on
train_test_splitLogisticRegression.fit(Xtr, ytr)model.score(Xte, yte)Three flowers, four measurements each. The model learns to map measurements to species, then reports accuracy on the held-out test set — a real, if tiny, check.
The .fit(Xtr, ytr) call does the learning. The trap is judging the model by its score on Xtr (the training data); the honest number is model.score(Xte, yte) on held-out data.
Hold back part of the data as a test set so the score later means something.
The learns weights from the training half — this single call is the learning.
Evaluate on the held-out half to estimate to new data.
Verify before you trust an AI-generated ML snippet. Assistants often produce code that looks right but reports a misleading score. Check these four things:
The most common mistakes are not technical — they are conceptual: calling everything 'AI', assuming deep learning is always best, and trusting a model that memorized its training data. Spot these, recall the core ideas from memory, and the distinction is yours.
The traps — overfitting, calling everything AI, ignoring data needs — and a self-test.
Why this matters: It matters because spotting the failure first is what separates understanding from memorizing.
Before reading on, predict from memory: back in module 2 you met the training loop. What single number does an ML model try to shrink, and what does a good score on held-out data prove?
(The answer: it shrinks the , and a good score on unseen data proves — that it learned the pattern, not the examples.)
These are the misreadings that cause real mistakes — in conversations, in tool choices, and in budgets.
A hand-coded rule and a billion-parameter network are both , but they need wildly different data, cost, and oversight. Flattening them hides which one you actually have.
On small, tabular, or interpretability-critical problems, a classic model often wins on speed, cost, and explainability. Bigger is not automatically better.
A can score nearly perfectly on its training data and still fail on new data. That is overfitting — a failure of , not a crash. It is invisible unless you test on held-out data.
Close the book and reconstruct it from memory: Draw the three nested circles and label each one. Say what makes a system ML rather than rule-based AI, and deep learning rather than classic ML. Name the single number a model shrinks while training, and the test that proves it learned. Finally, give the one question that should make you pick a classic model over a deep one.
If any answer is fuzzy, reopen that module — that is exactly the part to revisit.
Pick a real product you use and write a half-page: which circle does its 'AI' live in (rule-based, classic ML, or deep learning), what evidence makes you think so, and which simpler approach could have worked instead. Then build on it: take the 8-line classifier from module 4, swap in a different scikit-learn dataset, and confirm the held-out score still beats guessing.
Which statement best describes the relationship between AI, ML, and deep learning?
The three form a nesting: every ML system is an AI system, and every deep learning system is an ML system — they are not rivals or synonyms.
In the standard ML training loop, what happens immediately after the model makes a prediction?
The loop is: predict → measure loss → adjust weights → repeat. Measuring the loss is the step that tells the model how wrong it was.
A small startup has a structured spreadsheet of 800 customer records and needs to predict churn. They have no GPU budget and need results their manager can explain. Which approach fits best?
Classic ML is the narrowest circle that solves the problem here: small structured data, low compute budget, and a need for interpretability all point away from deep learning.
Look at this two-line scikit-learn snippet:
model.fit(X_train, y_train) score = model.score(X_test, y_test)
Which line does the learning, and which line measures generalization? Explain in one sentence each.
fit() is the training step; score() on held-out test data is the generalization check. Using test data the model never trained on is what makes the score meaningful.
A model scores 99% accuracy on its training data but only 61% on new data. What is the most likely problem?
Overfitting means the model learned the training data too specifically — it performs well in-sample but fails on unseen data. It is a generalization failure, not a code bug.