Layers: A Small Neural Network
A neural network arranges neurons in layers. The first layer's outputs become the next layer's inputs. With matrices, a whole layer is one line: activation(inputs @ weights + bias). A network with a hidden layer can solve problems a single neuron cannot, such as XOR (true when exactly one input is 1).
The weights below were chosen by hand so that you can follow the maths. In practice training finds them.
Examplepython
Quick check
Why add a hidden layer?
Your turn: write the code
Print the network's output (as an int) for the inputs a=1, b=1.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.