Class 1 · From one neuron to a trained network

How do several neurons learn together?

We already know that a neuron computes a weighted sum and applies an activation. This class connects many such computations into a single-hidden-layer network, follows one prediction forward, sends its error backward, and updates every parameter from scratch.

Opening challenge

If logistic regression already contains a weighted sum and sigmoid activation, what new capability does a hidden layer add?

Linear model fails
Neurons learn features
Forward prediction
Backward gradients
Parameter update

The entire class in one sentence: hidden neurons learn intermediate features, the output neuron combines them, and backpropagation tells every weight how it should change to reduce the final loss.

The network we will keep throughout

A 2 → 2 → 1 binary classifier: two features, two hidden neurons, and one predicted probability.

InputsX: m × 2
Hidden weightsW[1]: 2 × 2
Output weightsW[2]: 2 × 1
PredictionsA[2]: m × 1

Three-hour path

TimeTeaching movementStudent outcome
00–10XOR and the failure of one boundaryExplain why combining neurons is necessary
10–35Activation functions and derivativesChoose hidden and output activations
35–65Single-hidden-layer architectureTrack parameters and tensor shapes
65–95Forward pass, loss and backward passFollow one example mathematically
95–105Break
105–160NumPy implementationTrain the network from scratch
160–175Loss and boundary visualizationsDiagnose whether learning occurred
175–180Retrieval summaryReconstruct the algorithm without notes

The story pages

Begin: why a network?