insideout Get Pro
Learn
AI engineering · Module 02

Neural Networks

Build a small network and train it with gradients you compute.

Start here · Lesson 01

One neuron

Inputs times weights, plus a bias, through an activation function.

Start lesson

LessonsAll lessons

  1. 01 One neuronInputs times weights, plus a bias, through an activation function. Free
  2. 02 Stacking neurons into layersWhy one neuron can't solve XOR, and how a hidden layer can. Free
  3. 03 Loss functionsOne number for how far off the network is, and why its shape matters. Free
  4. 04 Updating weights with gradientsMove every weight against its gradient, then repeat until the loss falls. Pro
  5. 05 The chain rule by handWork out each weight's gradient through a small network, step by step. Pro
  6. 06 Autograd you can step throughWrite backward() for a few operations and watch gradients flow through a graph. Pro
  7. 07 Backprop through softmax and cross-entropyThe gradient every classifier and language model starts from, derived by hand. Pro
  8. 08 Diagnosing a network that won't trainDead units, exploding gradients and bad starting weights, and the fixes. Pro
  9. 09 Momentum, Adam and learning-rate schedulesHow real training runs set the size of every weight's step. Pro
  10. 10 Train a classifier on your own autogradPut the pieces together and train a small network end to end. Pro

Build it yourself · on your own machine

A digit reader from scratch

A two-layer network in plain NumPy that reads handwritten digits, with every gradient written by you.
  1. Load scikit-learn's digits dataset (8 by 8 images of 0 to 9) and split it 80/20 into training and test sets.
  2. Write the forward pass: 64 inputs, 32 hidden units with ReLU, 10 outputs through softmax.
  3. Write the cross-entropy loss and the backward pass by hand, then check one gradient against a numerical estimate.
  4. Train with mini-batch gradient descent and plot training and test loss on the same chart.
  5. Show the ten test digits it gets wrong with the most confidence, and say what they have in common.

How you'll know it worksTest accuracy of at least 95%, and your hand-written gradients agree with the numerical ones to within 1e-5.

Python, NumPy, scikit-learn (for the data only) and matplotlib. Runs on any laptop in seconds. Uses lessons 01 to 10.