Traditional software is told exactly what to do. Machine learning software is shown examples and works out the rules for itself. That single shift is what makes modern AI possible.
In traditional programming, a human writes the exact rules, and the computer applies them to data to produce an answer. Machine learning flips that process: a human supplies examples of data and the correct answers, and the computer works out the rules for itself. That single reversal — rules discovered instead of rules written — is what allows software to handle problems, like recognising a face or translating a sentence, that would be nearly impossible to hand-code rule by rule.
The clearest way to see the shift is to compare the two approaches side by side, using the same problem: sorting emails into "spam" or "not spam."
In machine learning, this learned set of rules is called a model. Once trained, the model can be given a brand-new, never-seen-before email and use the patterns it learned to predict whether it's spam — without a human ever writing an explicit rule like "contains the word 'free'."
Machine learning isn't one single technique — it's a family of approaches, grouped by how the learning happens.
| Type | How It Learns | Example Use |
|---|---|---|
| Supervised Learning | Learns from labelled examples (input paired with the correct answer) | Spam detection, predicting house prices |
| Unsupervised Learning | Finds patterns or groupings in data that has no labelled answers | Grouping customers by shopping habits |
| Reinforcement Learning | Learns by trial and error, receiving rewards or penalties for actions | Game-playing AI, robotics |
Supervised learning is the most common starting point and the easiest to understand, so the rest of this guide focuses mainly on it.
Imagine training a very simple model to predict a house's price based only on its size. The model starts with a basic guess — a straight-line formula: price = (size × weight) + bias — where weight and bias are numbers the model doesn't yet know the right value for.
| Size (m²) | Actual Price |
|---|---|
| 50 | $150,000 |
| 80 | $230,000 |
| 120 | $340,000 |
Training happens in a loop: the model makes a prediction using its current weight and bias, compares that prediction to the actual price to calculate an error (also called loss), and then slightly adjusts the weight and bias to make the error a little smaller. This loop, called gradient descent, repeats thousands of times until the predictions become as accurate as the model can make them.
weight = 0.0 bias = 0.0 learning_rate = 0.0001 for epoch in range(1000): for size, actual_price in training_data: prediction = (size * weight) + bias error = actual_price - prediction # nudge weight and bias to reduce the error weight += learning_rate * error * size bias += learning_rate * error
Each pass through all the training data is called an epoch. By the end of training, weight and bias have settled on values that let the formula predict prices reasonably well for houses it has never seen before — this is the entire "learning" in machine learning: adjusting numbers until error is minimised.
A trained model is really just a set of numbers (weights) that have been carefully tuned. "Training" a model and "running" a trained model are two very different processes — training can take enormous amounts of computing time, while using an already-trained model to make a single prediction is usually fast.
The house-price example used one simple formula. Many modern machine learning systems instead use neural networks — models loosely inspired by neurons in the brain, built from layers of connected units, or nodes. Data enters through an input layer, passes through one or more hidden layers that combine and transform it, and produces a result at the output layer.
Each connection between nodes has its own weight, adjusted during training the same way as the simple house-price example — just with millions or billions of weights instead of two. A network with many hidden layers is what gives deep learning its name, and this layered structure is what allows models to learn far more complex patterns than a single straight-line formula could, such as recognising objects in photos or generating natural-sounding text.
A streaming service's "recommended for you" list is generated by a model trained on millions of users' viewing histories, learning patterns like which shows tend to be watched by similar audiences — without any human writing a rule for every possible combination of shows and viewers.
Beyond recommendations, machine learning also powers voice assistants converting speech to text, banks flagging potentially fraudulent transactions, email spam filters, photo apps recognising faces, and the autocomplete suggestions in a search bar.
Machine learning is powerful, but it isn't magic, and it inherits problems from wherever its training data came from.
Every impressive machine learning system, no matter how advanced, is built from the same core loop covered here: make a prediction, measure the error, adjust the numbers, repeat. What changes between a simple house-price predictor and a state-of-the-art AI system is mostly scale — more data, more layers, more computing power — not a fundamentally different idea. Understanding this loop is the foundation for understanding everything else in modern AI.
10 questions. Select an answer for each, then submit to see your score instantly.