Skip to main content
Independent Digital Museum of Artificial Intelligence · Laboratory
Accessibility

These choices are saved only on this device.

English

Laboratory · Interactive exhibit LAB-09

A small neural network that learns to read digits

Draw a digit on an 8×8 grid and see that, before training, the network guesses at random. Then train it and watch its accuracy on samples it has seen and on samples it has not.

Simulation: real training of a small network on UCI data, run locally

Try it

Draw a digit

Arrow keys move around. Enter or space applies the tool. With a mouse you can drag.

Tool

Probabilities given by the network

    Observe

    1. Draw a 3 before training. What does the network answer and how confident is it?
    2. Train the network with 16 hidden neurons and draw again. Did the answer change?
    3. Try 4 hidden neurons and compare the two lines of the chart with those for 32 neurons.
    4. Press “Random noise”. Does the network give an answer to something that is not a digit?

    What happened

    The network takes 64 numbers, the intensities of the cells, passes them through a hidden layer of neurons and gives 10 probabilities, one per digit. During training it sees known examples, compares its answer with the correct one and adjusts its weights a little. This repeats epoch after epoch. The numbers you see are computed at that moment in your browser and are not stored.

    20% of the samples are kept aside and never used for training. Accuracy there shows whether the network generalises or just remembers. The split is random and all samples come from the same 13 people, so the figure is more optimistic than it would be with handwriting from people the network has never seen. Your own drawing is a harder test.

    The softmax output always adds up to 100%. That is why the network cannot say “I don’t know” and gives a digit even for noise. If you need that ability, you have to design it separately.

    What to keep

    • Training means adjusting numbers (weights) so that the error on examples goes down.
    • Measure accuracy on samples that were not used for training, otherwise the result misleads.
    • A network always answers, even when the input is outside what it has seen. Confidence is not truth.

    Documentation

    The data is the UCI test set: 1,797 samples from 13 people, an 8×8 grid with values from 0 to 16. It is not the MNIST set. It is embedded in the page and is not downloaded from anywhere.

    Curatorial note: Nothing you draw is sent anywhere. The network is educational and does not represent the handwriting recognition systems used in practice.