The life cycle of an AI system ▶ Watch
- Collect data - gather examples: photos, text, sales records, sensor readings.
- Prepare data - clean errors, remove duplicates, and label examples ("this photo is a cat").
- Train - the model looks at the examples and adjusts itself to make fewer mistakes.
- Evaluate - test the model on data it has never seen to check it really learned, not memorised.
- Deploy - put the model inside an app, website or device.
- Predict (inference) - the model answers new questions; its performance is monitored and improved.
Data: the fuel of AI ▶ Watch
An AI model can only be as good as the data it learns from. Data can be structured (tables with rows and columns, like a spreadsheet of house prices) or unstructured (free text, images, audio, video). Most of the world's data is unstructured, which is why deep learning, which handles it well, became so important.
Before training, data is usually split into three parts: a training set (to learn from, often about 80%), a validation set (to tune settings) and a test set (a final exam the model never saw).
Inside a neural network: the artificial neuron ▶ Watch
Deep learning is inspired - loosely - by the brain. Its basic unit is the artificial neuron, a tiny calculator.
- It receives several inputs (numbers).
- Each input is multiplied by a weight - how important that input is.
- The results are added together with a bias.
- An activation function decides how strongly the neuron "fires".
- The output is passed on to neurons in the next layer.
Layers make it "deep" ▶ Watch
Neurons are organised in layers. In an image classifier, the first hidden layers detect simple features such as edges and colours; deeper layers combine them into shapes such as eyes and ears; the final layer decides "cat" or "dog". A network with many hidden layers is called a deep neural network - hence "deep learning". Modern large models contain billions of weights.
How a network learns ▶ Watch
At the start, all the weights are random, so the network guesses badly. Training fixes this through a loop:
- Forward pass - the network makes a prediction for a training example.
- Loss - a loss function measures how wrong the prediction was.
- Backpropagation - the error is traced backwards to see how much each weight contributed to it.
- Gradient descent - every weight is nudged slightly in the direction that reduces the error.
- Repeat - millions of times, over many passes through the data (called epochs).
Overfitting and underfitting ▶ Watch
| Problem | What happens | Typical fix |
|---|---|---|
| Underfitting | Model is too simple; poor on training and test data. | Bigger model, better features, train longer |
| Overfitting | Model memorises training data; poor on new data. | More data, simpler model, regularisation |
| Good fit | Performs well on data it has never seen. | Keep monitoring after deployment |
Measuring how good a model is ▶ Watch
- Accuracy - the percentage of predictions that are correct.
- Precision - of everything the model flagged as positive, how much really was positive.
- Recall - of all the real positives, how many the model found.
- For language models, people also use human ratings and benchmark exams covering maths, coding and reasoning.
Chapter summary
- AI systems follow a cycle: collect, prepare, train, evaluate, deploy, predict and improve.
- Neural networks are layers of simple artificial neurons connected by weights.
- Training repeatedly adjusts weights to reduce error, using backpropagation and gradient descent.
- A good model performs well on new data, not just the data it trained on.