Building a Mini Network
Wire multiple neurons together and see emergent behavior.
The Story
One neuron can only do so much — it draws a single line in the sand. But wire a few together, and something magical happens: emergence. The network can learn patterns that no single neuron could represent.
The Layer
A layer is just a collection of neurons that all receive the same inputs, but each has its own weights and bias. If we have 2 inputs and 3 neurons in a layer, we need 6 weights (2 per neuron) and 3 biases.
def layer(inputs, all_weights, all_biases):
return [neuron(inputs, w, b) for w, b in zip(all_weights, all_biases)]
The Network
Stack two layers and you have a network. The output of the first layer becomes the input to the second. That's it — a feedforward neural network.
# Layer 1: 2 inputs -> 3 neurons
hidden = layer(inputs, weights1, biases1)
# Layer 2: 3 inputs (from layer 1) -> 1 neuron
output = layer(hidden, weights2, biases2)
Why This Matters
A single neuron draws a line. A layer draws many lines. A network of layers can draw curves, contours, and complex decision boundaries. This is the power of composition.
Exercises
Loading Python runtime (Pyodide)...
Primary Source: Andrej Karpathy — Neural Networks: Zero to Hero (Video 1)