Complete mathematical explanation behind the code.
With real numbers and interactive examples.
Educational companion to the Mobile MLP Digits Demo
Sigmoid squashes any number into a value between 0 and 1. This is crucial because:
This is when the network makes a prediction. Input data flows through the weights and activations and finally produces 10 numbers.
For every neuron in the next layer:
Change the inputs and watch the numbers flow through the network in real time.
| h₁ | h₂ | |
|---|---|---|
| x₁ | ||
| x₂ | ||
| bias |
| out | |
|---|---|
| h₁ | |
| h₂ | |
| bias |
This is how the network learns. It compares what it predicted with what it should have predicted, then adjusts the weights.
The network uses gradient descent. It finds the direction where the error decreases fastest and takes a small step in that direction (learning rate = 0.15 in the original code).