Deep Neural Networks

Lesson 1

From linear regression to the perceptron

The smallest unit: a weighted sum, a bias, and an activation

From linear regression to the perceptron

Deep neural networks are built from layers of simple units. Before depth or convolutions, it pays to understand the smallest piece: one weighted sum of inputs, plus bias, optionally passed through an activation. This lesson walks from linear regressionlogistic regressionperceptron, then clarifies what people mean by a neuron today, and how that story fits the connectionist view researchers like Geoffrey Hinton championed: intelligence from many adjustable units learning from data, not hand-written rules alone.

One picture for the whole lesson

Features xlinear part z = wᵀx + bactivation f(z)output

Change only f and the loss, you move from regression to classification to a modern building block.

One neuron: three weighted inputs, a bias, and the sigmoid activation give a binary prediction ŷ.

+1−1decision line
w₁1.00
w₂1.00
bias b0.00
z = 1.00·x₁ + 1.00·x₂ + 0.00
0.0%
accuracy on the points

Step 0, Features and a linear score

Given input vector x (features) and weights w plus bias b, the affine (linear-with-bias) map is:

z=wx+bz = \mathbf{w}^\top \mathbf{x} + b

This z is a score: a single number summarizing the input in a direction learned from data. Everything below reuses this same z; only what happens after z changes.


1 · Linear regression (no activation on the prediction)

Goal: predict a real value ŷ.

y^=z=wx+b\hat{y} = z = \mathbf{w}^\top \mathbf{x} + b

Loss: squared error (and friends). Output is unbounded, fine for prices, temperatures, etc.

Neuron view: a “neuron” with identity activation f(z) = z. No squashing, pure linear model.


2 · Logistic regression (one neuron with sigmoid)

Goal: predict probability for binary class y ∈ 1.

Same z, then squash with the sigmoid:

y^=σ(z)=11+ez(0,1)\hat{y} = \sigma(z) = \frac{1}{1 + e^{-z}} \in (0, 1)

Loss: log loss / cross-entropy. You already have one computational unit: linear + nonlinear σ, the template for a classification neuron.

ModelAfter z = wᵀx + bTypical loss
Linear regressionŷ = z (identity)Squared error
Logistic regressionŷ = σ(z)Binary cross-entropy

3 · The perceptron (Rosenblatt, 1958)

Historically, the perceptron is a binary linear classifier with a hard decision:

y^=sign(z)or1[z0]\hat{y} = \operatorname{sign}(z) \quad\text{or}\quad \mathbb{1}[z \ge 0]

Weights were updated with the perceptron learning rule (mistake-driven). The geometry is the same linear boundary as logistic regression; the activation is not smooth, it jumps at zero.

Linear

Continuous ŷ

Logistic

Smooth σ(z)

Perceptron

Hard sign(z)

The three activations on the same score z

z
Linear · f(z) = z
z
Logistic · σ(z)
z
Perceptron · sign(z)

Same linear score z, three different activations, three models.

Limitation (famous): a single perceptron only learns linearly separable patterns, no XOR without multiple units / hidden layers (the start of the story for deep networks).


Perceptron vs “neuron” in modern deep learning

People use “neuron” loosely. In current frameworks, a neuron almost always means:

affine map + differentiable activation (ReLU, GELU, sigmoid, tanh, …) so gradients can flow in backpropagation.

AspectClassic perceptronTypical “neuron” today
NonlinearityStep / sign (not differentiable at 0)ReLU, GELU, σ, … (piecewise smooth)
TrainingPerceptron rule, mistake updatesGradient descent on a loss (backprop)
Output roleOften hard class labelReal-valued activation feeding next layer
Summary

Logistic regression is closer to a modern classification neuron (smooth σ) than the original perceptron sign, but all three share the same linear core z = wᵀx + b.


Hinton and the idea of neural computation

Geoffrey Hinton did not invent the perceptron; his influence is in treating networks of simple units as the right substrate for learning representations: adjust many w’s and b’s from examples so hierarchical features emerge. Backpropagation through smooth activations made deep stacks practical, so the “neuron” in today’s deep nets is the differentiable building block you will stack in the rest of this course.

Takeaway: linear regression = linear neuron; logistic = sigmoid neuron; perceptron = historical threshold unit on the same z. Deep networks = many such units + depth and composition, next lessons.


Your whiteboard

Sketch your own version of the neuron, annotate the parts you want to remember, or draw a comparison with the perceptron's step function. Changes live in your browser only.

✏️ Scratchpad — draw, annotate, or erase freely. Changes stay in your browser only.


Build the unit yourself

One neuron is a weighted sum, a bias, and an activation. Press Run to push the same score z through all three activations, then watch a single linear unit fail on XOR:

Python
First run loads the Python runtime (~10 MB) — takes ~5–10 seconds. Subsequent runs are instant.

Check your understanding

1 / 9

Rosenblatt's perceptron uses a threshold (step) activation. Why does the modern artificial neuron replace it with sigmoid (or ReLU)?


Practice it yourself

One linear core, three behaviours. Build the neuron and the perceptron from scratch in the browser, with real Python and hidden tests, no setup.

Test your understanding

Prof is ready

Prof will ask you questions about From linear regression to the perceptron — not explain it. You'll be surprised what you don't know until you have to say it.

Finished this lesson?

Read through the lesson first (0/20s).