Deep Learning Slides 📂 Introduction · 1 of 18 38 min read

Deep Learning vs Machine Learning — The Real Difference

A clear, visual guide to what actually separates deep learning from classical machine learning: hand-crafted features vs features the network learns for itself. See the AI hierarchy, how a neuron and backpropagation work, when trees beat neural nets, and the CNN-vs-Random-Forest showdown on MNIST.

Deep Learning vs Machine Learning

One hands the algorithm facts; the other hands it raw sensory data and lets it learn what the facts even are. Understand the dividing line — and know which to reach for.
The Hierarchy Learned Features Neurons & Backprop Which to Use

Press Next → or use ← → arrow keys

Section 01

Hand-Crafted vs Learned Features

Two ways to tell a cat from a dog
The classical-ML detective painstakingly measures features by hand — ear shape, snout length, fur texture — then feeds those numbers to a model. The deep-learning oracle stares at the raw pixels and discovers the telling patterns itself. That shift — hand-crafted features vs learned features — is the whole story.
Classical ML raw human featuresear · snout · fur model cat/dog Deep Learning raw px neural network — learns the features itselfedges → shapes → parts → concept cat/dog
🧩
DL is a subset of ML, not a replacement

All deep learning is machine learning — it just adds layered neural networks that learn hierarchical representations straight from raw data. But not all ML is deep learning.

Section 02

The AI Family Tree

Artificial Intelligence rules · search · logic — mimic human intelligence Machine Learning learns from data, not hand-written rules Deep Learning multi-layer neural nets · automatic features Foundation Models / LLMs GPT · BERT · Gemini · Claude — internet-scale
🪆
Nested, not parallel

Each layer lives inside the one above it. Today's LLMs are deep-learning models, which are machine-learning models, which are a form of AI — a set of nesting dolls, not competing fields.

Section 03

Feature Engineering — the Dividing Line

Classical ML is a kitchen of specialist chefs handing the machine tidy measurements — sweetness, salt, texture. Deep learning is a robot that tastes the raw ingredients and works out the balance itself.

Classical ML pipelineby
Collect raw dataengineer
Hand-extract featuresexpert
Scale / encodescientist
Map features → predictionalgorithm
Deep-learning pipelineby
Collect raw dataengineer
Feed raw data into networkalgorithm
Layer 1 learns edgesnetwork
Layer N learns faces → predictionnetwork
💰
You trade manual effort for compute & data

Deep learning removes the hand-engineering — but demands thousands to millions of labelled examples and serious GPU hours. Classical ML often learns from a few hundred rows on a laptop.

Section 04

Inside a Neuron

x₁ x₂ x₃ ×w₁×w₂×w₃ Σ+b σ (ReLU)non-linear y y = σ(Wx+b)
Neuron
y = σ(Wx + b)
weighted sum → activation → output
ReLU
max(0, z)
the default hidden-layer activation
Loss (cross-entropy)
−Σ y·log(ŷ)
how wrong the prediction is
Weight update (SGD)
w ← w − η·∂L/∂w
nudge weights downhill on the loss
Pro · Non-linearity

Why Activations Matter

ReLU = max(0, z) Sigmoid → (0,1) tanh → (−1,1)
🌀
Without them, a deep net is just one line

Stack linear layers and the whole thing collapses to a single linear map — no matter how deep. The non-linear activation between layers is what lets a network bend, curve and compose simple parts into complex concepts. ReLU is the modern default; sigmoid/softmax live at the output for probabilities.

Section 05

How Learning Happens — Backpropagation

Picture a faulty product at the end of an assembly line. The manager walks the blame backwards through every worker. Backprop does exactly that with calculus — pushing the error back through the layers and assigning each weight its share.

Inputx Hidden Hidden Output ŷ Lossvs y forward pass → ← backward: gradients (chain rule) blame every weight
🔁
Forward → loss → backward → update → repeat

Each epoch: predict forward, measure the loss, backprop the gradients, let the optimiser (SGD, Adam) nudge every weight downhill. After enough epochs the loss flattens — the network has converged.

Section 06

ML vs Deep Learning — Side by Side

PropertyClassical MLDeep Learning
Feature extractionmanual (expert)automatic (learned)
Data neededhundreds of rowsthousands–millions
ComputeCPU / laptopGPU/TPU · hours–weeks
Interpretabilityoften explainableblack box
Best datatabular / structuredimages, text, audio, video
Tabular performanceexcellent (XGBoost often wins)competitive, rarely better
Unstructured performancepoorstate-of-the-art
Transfer learningnoyes — reuse pre-trained models
🧭
The practitioner's rule

Start with classical ML for tabular data — faster, more interpretable, often just as accurate. Move to deep learning for images, audio and text, where hand-crafting features is too costly or simply impossible.

Section 07

Where Each One Wins

📊
Classical ML wins
Structured tables: credit scoring, fraud, churn, house prices, risk. XGBoost & Random Forest usually beat nets under ~100K rows of meaningful numbers.
🖼️
Deep learning wins
Raw signals: image classification, object detection, speech, translation, sentiment, generative AI. Anywhere hand-crafted features are impossible.
🌫️
The gray zone
Recommenders, time-series, NLP on structured logs. Transformers (TabTransformer, FT-Transformer) are now challenging XGBoost on tables.
🎛️
Match the tool to the data's shape

The deciding question is rarely "which is better?" — it's "is my signal already in tidy columns, or buried in raw pixels, waveforms and words?" That answers it almost every time.

Section 08

Layers Learn a Hierarchy of Meaning

Layers 1–2 · edges Layers 3–5 · textures 👁️Layers 6–10 · parts "cat" 🐱Final · concepts no one told the network what an "edge" or a "whisker" is — it discovered them from raw pixels
🔁
Early layers are universal — so you can reuse them

Edges and textures exist in all natural images, so a net trained on ImageNet can be fine-tuned on a 500-image medical set: freeze the early layers, retrain only the final classifier. Classical models can't share internal representations like this — the heart of transfer learning.

Section 09

MNIST — Random Forest vs CNN

# Classical ML — flatten pixels, no structure
X = X_train.reshape(-1, 784) / 255.
RandomForestClassifier(n_estimators=100).fit(X, y)
# → 0.9705

# Deep learning — Conv layers find the features
models.Sequential([
  layers.Conv2D(32, (3,3), activation='relu'),
  layers.MaxPooling2D(),
  layers.Conv2D(64, (3,3), activation='relu'),
  layers.MaxPooling2D(),
  layers.Flatten(),
  layers.Dense(10, activation='softmax')])
# → 0.9921
Test accuracy on MNIST 97.05%Random Forest 99.21%CNN
🔬
Why the CNN pulls ahead

The forest treats every pixel independently — blind to spatial structure. The CNN learns that edges form curves and curves form digits: a hierarchy no classical model can discover on its own.

Section 10

When to Use Which — Six Signals

🚦 READ THE SIGNAL, PICK THE TOOL
1
Clean spreadsheet (<500K rows) → XGBoost / Random Forest first. Faster, explainable, usually just as accurate.
2
Images, audio, raw text → deep learning from the start. Pre-trained CNNs & Transformers crush hand-crafted pipelines.
3
< 1,000 labelled examples → be careful with DL (overfits). Use transfer learning or regularised classical ML.
4
Explainability required (medical, loans, legal) → classical ML. SHAP & tree paths beat saliency maps.
5
Tight compute / latency → classical ML. Forests train in seconds; ResNet takes GPU-hours.
6
Generative task (make images, write text) → deep learning is the only option.
Section 11

The Deep-Learning Architecture Map

🖼️ CNN
convolution
Spatial filters detect local patterns — the ruler of computer vision.
+ LeNet · VGG · ResNet · EfficientNet
🔁 RNN / LSTM
sequence memory
Carries a hidden state across time steps; LSTM gates solved vanishing gradients.
− mostly replaced by Transformers for text
⚡ Transformer
self-attention
Relates every position to every other at once. Powers BERT, GPT, ViT — and Claude.
+ the backbone of every modern LLM
🗺️
One family, three specialisations

CNNs see space, RNNs/LSTMs remember sequence, Transformers attend to everything at once. Nearly all of today's frontier models are Transformers — but each shape still fits its data best.

Pro · Frontier

The Boundary Is Moving

◀ tidy tables gray zone raw pixels & text ▶ XGBoost TabTransformer · FT-Transformer CNN · Transformer
🔮
Deep learning is creeping into the tabular world

For years XGBoost owned structured data. Now attention-based models like TabTransformer and FT-Transformer are closing the gap — and transfer learning across tables is an active research front. The "use trees for tables" rule still holds for most projects today, but the frontier is genuinely shifting.

🧪
Stay empirical

Don't pick a camp — benchmark. On your own data, a tuned gradient-boosted tree and a modern tabular Transformer are both a few lines away. Let the validation score decide.

Summary

The One-Sentence Summary

📊
Classical ML

You hand the algorithm facts → it learns a decision. The features are your job.

🧠
Deep learning

You hand the algorithm raw data → it learns what facts to extract, then the decision. The features are its job.

🎯
The extra meta-learning step

Deep learning adds one thing: it learns the representation itself. That makes it unbeatable on unstructured data — and expensive, data-hungry and opaque on everything else. Choose by the shape of your data, not the hype.

🧠 Next up: The Biological Neuron & the McCulloch-Pitts Model · Press to review