AI Learning Courses
AI Learning Courses › Chapters › Chapter 3
CHAPTER 3 OF 15

How AI Works

You do not need advanced maths to understand how AI works. In this chapter we follow the life of an AI system from raw data to a working prediction, and look inside the artificial neurons that make deep learning possible.

▶ Watch the 12 narrated lessons Take the chapter quiz

The life cycle of an AI system ▶ Watch

The six stages of building and using an AI model, with a feedback loop for continuous improvement.
The six stages of building and using an AI model, with a feedback loop for continuous improvement.
▶ Play this diagram as a visual lesson
  1. Collect data - gather examples: photos, text, sales records, sensor readings.
  2. Prepare data - clean errors, remove duplicates, and label examples ("this photo is a cat").
  3. Train - the model looks at the examples and adjusts itself to make fewer mistakes.
  4. Evaluate - test the model on data it has never seen to check it really learned, not memorised.
  5. Deploy - put the model inside an app, website or device.
  6. 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.

An artificial neuron multiplies each input by a weight, adds them up, and passes the result through an activation function.
An artificial neuron multiplies each input by a weight, adds them up, and passes the result through an activation function.
▶ Play this diagram as a visual lesson
  1. It receives several inputs (numbers).
  2. Each input is multiplied by a weight - how important that input is.
  3. The results are added together with a bias.
  4. An activation function decides how strongly the neuron "fires".
  5. The output is passed on to neurons in the next layer.

Layers make it "deep" ▶ Watch

Neurons are arranged in layers. Each hidden layer finds more complex patterns than the one before.
Neurons are arranged in layers. Each hidden layer finds more complex patterns than the one before.
▶ Play this diagram as a visual lesson

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:

  1. Forward pass - the network makes a prediction for a training example.
  2. Loss - a loss function measures how wrong the prediction was.
  3. Backpropagation - the error is traced backwards to see how much each weight contributed to it.
  4. Gradient descent - every weight is nudged slightly in the direction that reduces the error.
  5. Repeat - millions of times, over many passes through the data (called epochs).

Overfitting and underfitting ▶ Watch

ProblemWhat happensTypical fix
UnderfittingModel is too simple; poor on training and test data.Bigger model, better features, train longer
OverfittingModel memorises training data; poor on new data.More data, simpler model, regularisation
Good fitPerforms well on data it has never seen.Keep monitoring after deployment

Measuring how good a model is ▶ Watch

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.