AI vs ML vs Deep Learning
News articles use "AI", "machine learning" and "deep learning" as if they were the same thing. They are not, and the difference matters when you choose a tool: the right answer to a problem may be a hand-written rule, a classical model or a deep network.
Three nested circles
The three terms describe nested fields. Every deep-learning system is a machine-learning system, and every machine-learning system is an AI system, but not the other way round.
| Artificial intelligence | Machine learning | Deep learning | |
|---|---|---|---|
| Scope | any technique for intelligent behaviour | AI that learns from data | ML with multi-layer neural networks |
| Where the behaviour comes from | rules, search, logic or learning | patterns fitted to examples | patterns and features learned from raw data |
| Typical data needs | none to a lot | hundreds to millions of examples | usually many thousands to billions |
| Features | designed by people, if any | mostly designed by people | learned by the network |
| Compute | small to large | small to moderate (a laptop CPU) | moderate to huge (GPUs, clusters) |
| Explainability | rules are fully readable | small models are readable (trees, linear weights) | hard to explain; needs special tools |
| Examples | route planner, chess engine, tax rules | credit scoring, churn prediction, spam filter | image recognition, speech, translation, LLMs |
One problem, three approaches
The "circles" data set has one class inside a ring of the other. We solve it three ways: a rule written by a person who looked at the data, two classical ML models, and a neural network.
import numpy as np
from sklearn.datasets import make_circles
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neural_network import MLPClassifier
X, y = make_circles(n_samples=600, noise=0.1, factor=0.5, random_state=0)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0)
# 1. Classic AI: a person who looked at the data writes the rule (inner circle = class 1).
def rule(X):
return (np.hypot(X[:, 0], X[:, 1]) < 0.75).astype(int)
print(f"{'hand-written rule':31} {np.mean(rule(X_test) == y_test):.3f}")
# 2. Machine learning: the rule is learned from the training examples.
for name, model in [
("logistic regression (line)", LogisticRegression()),
("decision tree, depth 6", DecisionTreeClassifier(max_depth=6, random_state=0)),
("neural network (deep learning)", MLPClassifier(hidden_layer_sizes=(32, 32), max_iter=2000, random_state=0)),
]:
model.fit(X_train, y_train)
print(f"{name:31} {model.score(X_test, y_test):.3f}")hand-written rule 0.987
logistic regression (line) 0.470
decision tree, depth 6 0.977
neural network (deep learning) 0.983
What the numbers say, on 300 test points:
- The hand-written rule wins (0.987). In two dimensions a person can see the pattern, "distance from the centre below 0.75", and write it down. When the rule is known and simple, writing it is cheaper, faster and more transparent than learning it.
- The wrong model family fails (0.470). Logistic regression can only draw a straight line, which cannot separate a ring from its centre. It does worse than a coin flip here. Choosing a model that matches the shape of the problem matters more than choosing a fashionable one.
- Flexible models learn the pattern (0.977 and 0.983). The tree builds the circle out of rectangular steps; the neural network learns a smooth closed boundary. Neither was told about circles.
The rule only works because we could look at two features. With 64 pixels, or 30 medical measurements, nobody can see the pattern, and learning is the only practical way.
Choosing between them
| Situation | Usually best |
|---|---|
| The logic is known and stable (tax rules, unit conversions, safety interlocks) | write the rules; no learning |
| A state space to explore with known moves (routing, scheduling, puzzles) | search and optimisation |
| Tabular data (rows of measurements), up to millions of rows | classical ML: linear models, gradient-boosted trees |
| Images, audio, video, free text | deep learning, often starting from a pretrained model |
| Little labelled data but a pretrained model exists | deep learning with transfer learning |
| Decisions must be explained line by line (some regulated settings) | rules or small interpretable models |
Real systems mix all three. A self-driving stack uses deep networks to see, classical estimators to track objects, and search to plan a route; a fraud system combines hard rules ("block cards reported stolen") with a learned risk score.
Pitfalls
- "Deep learning is always better." On small tabular data, a gradient-boosted tree typically matches or beats a neural network and trains in seconds.
- "ML replaces domain knowledge." Knowledge goes into ML through the features, the choice of model, the labels and the evaluation. In the example, knowing the classes are circular would let you add the feature "distance from the centre", and then even logistic regression would succeed.
- Calling every program "AI". A fixed threshold someone typed in is a rule. It may be good engineering, but it does not learn.
Practice
- Add the feature
r = np.hypot(X[:, 0], X[:, 1])as a third column and train logistic regression again. What do you expect, and why?
Answer
Logistic regression jumps from 0.470 to 0.987, the same score as the hand-written rule. In the new feature the classes are separated by a threshold on , which is a straight boundary in the three-dimensional feature space. Good features let simple models solve problems that looked non-linear: this is feature engineering.
- For each task, say whether you would start with rules, classical ML or deep learning: (a) converting currencies with today's rates, (b) predicting which customers will cancel a subscription from 25 account columns, (c) transcribing voicemail to text.
Answer
(a) rules: the formula is known. (b) classical ML on tabular data, for example gradient-boosted trees, with a logistic-regression baseline. (c) deep learning, using a pretrained speech-recognition model.
Test yourself
Which statement is true?
- Every AI system uses machine learning
- Every deep-learning system is a machine-learning system
- Machine learning and deep learning are the same
- Deep learning contains machine learning
Why did logistic regression score only 0.470 on the circles data?
- It was not trained long enough
- Its boundary is a straight line, which cannot separate a ring from its centre
- The data has too many rows
- It needs a GPU
For a table of 50,000 loan applications with 40 columns, what is the usual first choice?
- A large language model
- A deep convolutional network
- Classical ML such as gradient-boosted trees, with a simple baseline
- Breadth-first search
What is the main way deep learning differs from classical ML in how features are obtained?
- Deep networks learn features from raw data
- Classical ML learns its own features from pixels
- Deep learning uses no features
- There is no difference