Interactive demo
Neural Network in JavaScript
A small neural network written in plain JavaScript without any libraries. Configure it, train it and look inside while it learns.
How to use it
- Open “Learning Task” and choose XOR, separation, sphere or quadrant.
- Set the network layout as a comma-separated list, e.g. “2, 3, 1”: two inputs, one hidden layer with three neurons and one output.
- Adjust learning rate, iterations and activation function, then press “Train”.
- Compare the outputs of the test cases with the expected values. Hover over a neuron to see its current value.
What happens during training
For every example the network compares its output with the target and propagates the error back through the layers (backpropagation). Each weight is nudged a little in the direction that reduces the error. The weight matrices are listed below the network.