Syllabus Lesson 39 of 246 · Module 3: Neuron to MLP
Module 3: Neuron to MLP

One neuron predicts a price (linear regression)

Why it matters The simplest neural network is one neuron with no activation. It is also a classic tool: linear regression. Everything bigger is built from this.

Each house is two numbers: its size and how close it is to town (both scaled to between 0 and 1). The neuron predicts price = w1 * size + w2 * closeness + b. For a whole batch: X @ w + b.

Tiny numbers

With w = (3, 1.5) and b = 0.5, a house with size 0.5 and closeness 0.2 gets 1.5 + 0.3 + 0.5 = 2.3, meaning 230,000.

The loss is the mean squared error from Module 1: the average of (prediction minus truth) squared.

Linear regression: predicting a number as a weighted sum of inputs plus a bias. It is a single neuron without an activation.

Recap Predict with X @ w + b; score with mean squared error.

Words and symbols in this lesson
neuron
w . x + b, then an activation
weights (w, W), bias (b)
the numbers a neuron learns; the bias shifts its output
Your turn

Write predict(X, w, b) and mse(pred, y). Then set w_guess and b_guess by hand (try a few values and print the loss) so that the loss on the data is below 0.05.

Spotted a problem in this lesson? Report it · Ask about this lesson

This exercise opens soon

Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.