Theory
How a network learns
Back to the key question: how does a network go from "guesses at random" to "works"? The idea is simple and repeats over and over:
- Predict. The network takes an example (a photo) and gives an answer — at first almost random.
- Compare. We compare the guess to the correct answer. How far off is it? That error is measured by the loss.
- Adjust. The network nudges its weights a little in the direction that reduces the error. That direction is given by the gradients.
- Repeat. The same over thousands of examples, many times over. One full pass through all the data is an epoch.
predict → compare (loss) → adjust (gradients) → repeat (epochs)
▲ │
└────────────────────────────────────────────────────┘
With each round the guesses get better on average, and the accuracy number climbs. That is "learning" — no magic, just many small corrections.
Do not worry about the words "loss", "gradients", "epochs" — this is just an introduction. We unpack each one in its own lesson, slowly and with code. Today it is enough to feel the overall rhythm: predict → compare → adjust → repeat.
Next lesson we start from the foundation it all stands on: tensors — PyTorch's data structure, which turns an image into numbers and the network into calculations.