An interactive, real-time visualizer designed to demystify neural networks, backpropagation, and gradient descent.
| In A | In B | Target | Prediction | Error |
|---|
Hover or tap any neuron or weight in the diagram above to inspect its real-time mathematical operations, gradient directions, and role in learning.
A neural network is a collection of mathematical "neurons" organized in layers. In this interactive demo, we have three layers:
The arrows connecting neurons represent weights (w), which acts as multipliers. The bias (b) acts like an adjustable offset threshold for each neuron.
During a Forward Pass, data flows from left to right to create a prediction:
1. For any neuron, we sum all incoming inputs multiplied by their respective weights, and then add the neuron's bias:
2. We then pass this sum z through an activation function, like the Sigmoid function:
This squashes the value beautifully between 0 and 1, representing the neuron's "firing rate" or confidence.
How do we know if our network is doing a good job? We calculate its Loss (or cost). In this demo, we use Mean Squared Error (MSE):
The higher the difference between what the network predicted and the actual target, the higher the error. Our global objective is to find a set of weights and biases that makes this error as close to zero as possible across all training examples.
Backpropagation is the magic behind learning. It calculates how much each individual weight and bias contributed to the final error. It does this using calculus (the chain rule), flowing the error backwards from right to left:
As you click "Train", watch how the weights adjust and the loss curve trends downwards! If the learning rate is too low, progress is slow. If it's too high, the network might overshoot and fail to learn.