Basis Lab

From a Straight Line to Backpropagation

The Two Equations That Pin Down the Best Line

Last timeThe Line and the Size of Its Mistake

Setting both partial derivatives of the squared total to zero gives two linear equations in the slope and the intercept, 78w + 12b = 258 and 650w + 78b = 2106, solved here by hand to w = 3 and b = 2.

A score that ranks two candidate lines does not produce the best one. Twelve

measurements, yiy_i taken at the inputs xix_i for ii from 1 to n=12n = 12, fix

the total squared error

E(w,b)=∑i=112(yi−(wxi+b))2E(w, b) = \sum_{i=1}^{12} \big(y_i - (w x_i + b)\big)^2

as a function of the slope ww and the intercept bb, and the task is to find

the pair that makes it smallest out of a continuum of pairs. This is the one

place in the whole chain where that can be done exactly, by solving rather than

by searching, and it is worth seeing exactly why it works, because everything

later is a response to this argument failing.

The score as a function of two numbers

Expand one squared residual before adding anything up. Writing the residual as

yi−wxi−by_i - w x_i - b and squaring gives

The lesson stops here

14 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01Measuring How Wrong a Straight Line Is, on Twelve Points
  2. 02The Two Equations That Pin Down the Best Lineyou are here
  3. 03When the Derivative Equations Stop Being Solvableopening only
  4. 04The Largest Step This Data Allowsopening only
  5. 05Putting a Bend in the Model, and Differentiating Through Itopening only
  6. 06Every Derivative of a Two Unit Network, by Handopening only
  7. 07One Sweep Back Instead of Seven Chainsopening only
  8. 08Running It, and Reading the Curve It Producesopening only

Read alongside