View on GitHub

A neural network from scratch

Machine learning lesson ready

One straight line can’t solve this four-point puzzle. Two layers can.

The idea

XOR is the simplest problem a single straight line can’t solve: four points, two classes, arranged so no line separates them. In 1969, Minsky and Papert showed that a single-layer perceptron can’t learn it, and interest in neural networks cooled for years.

Add one hidden layer and the problem falls apart. The hidden layer bends the space so the classes become separable, and backpropagation tells every weight how to move. This lesson builds that network with nothing but NumPy.

What the lesson will build

Key ideas

The video

The lesson is ready: code and a line-by-line walkthrough in machine-learning/09-neural-network-from-scratch/.


All topics · Suggest a topic