What is machine learning? It is a way of building software that learns patterns from examples, instead of following rules a programmer wrote by hand. Show a program thousands of emails labelled "spam" or "not spam", and it works out for itself which features predict spam — then applies what it learned to emails it has never seen.

Machine learning is behind the recommendations on Netflix, the spam filter in your inbox, the face unlock on your phone and the chatbots that answer your questions. Here is how it actually works, in plain English.

The core idea: rules vs learning

Traditional programming works like a recipe. A programmer writes exact instructions: if this happens, do that. That works well for predictable jobs, like sorting a list or calculating a bill.

But many real problems have no neat set of rules. Nobody can write down the exact rules for "what does a cat look like" — there are too many shapes, colours, angles and lighting conditions. Machine learning takes a different approach: instead of rules, you give the computer examples and the right answers, and the algorithm adjusts itself until its answers match yours.

In 1959, AI pioneer Arthur Samuel defined it as "the field of study that gives computers the ability to learn without being explicitly programmed". The idea goes back further: in 1950, mathematician Alan Turing suggested that instead of trying to program a machine to think, we should teach it — the way you teach a child — by letting it learn from experience.

How does machine learning work?

Almost every machine learning system runs the same loop, whether it is a tiny spam filter or a giant chatbot:

  1. Predict. The model makes a guess for each training example. At first the guesses are terrible.
  2. Measure the error. A scoring function (called a loss function) measures how wrong each guess was.
  3. Adjust. An optimisation method, usually a version of gradient descent, nudges the model's internal numbers slightly in the direction that reduces the error.
  4. Repeat. The loop runs thousands or millions of times, until the error stops improving.

Then the model is tested on data it has never seen before, to check it learned the real pattern instead of just memorising the examples. A model that only memorises its training data is useless on anything new — a problem called overfitting.

Three ingredients are needed for any of this to work: a dataset (the examples), a model (the adjustable system that makes predictions) and a training algorithm (the loop that improves it). The output of training is a set of learned numbers, called parameters, that turn new inputs into predictions.

The three main types

Type How it learns Examples
Supervised learning From examples with correct answers (labels) Spam filters, price prediction, image recognition, medical scan screening
Unsupervised learning Finds structure in data without labels Grouping customers, discovering topics, spotting anomalies
Reinforcement learning By trial and error, from rewards and penalties Game-playing agents, robot control, tuning chatbot responses

Supervised learning is the most common. You feed the system labelled examples — thousands of photos labelled "cat" or "dog" — and it learns the boundary between them. Unsupervised learning gets no labels at all: you hand it a pile of customer data and it finds the natural groups by itself. Reinforcement learning learns like a dog learning tricks: it tries actions, gets a reward for good ones and a penalty for bad ones, and gradually finds the best strategy. There is also self-supervised learning, a newer approach where the system creates its own labels from raw data — this is how large language models learn from text.

What is deep learning?

Deep learning is machine learning that uses neural networks with many layers. Each layer transforms the data a little further: the first layers of an image model might detect edges, the next ones shapes, and the deeper ones whole objects like faces. That layered structure is loosely inspired by how neurons connect in a brain — which is why these systems are called neural networks.

Deep learning powers the most impressive AI of recent years: chatbots, image generators, voice assistants and self-driving cars. But it is a subset of machine learning, not a synonym for it. Simpler methods — like decision trees or linear models — still do plenty of everyday work, and they have the advantage that you can usually see why they made a decision. For more on the brain-inspired side, see what is a neural network, and for the chips that run these models, see what is an NPU.

Machine learning vs AI: what is the difference?

People use the two terms as if they mean the same thing. They do not.

  • Artificial intelligence (AI) is the broad goal: building computer systems that can think, reason and act at human levels — and the whole field of study around that goal.
  • Machine learning is one method of getting there: using data and statistics so systems improve by themselves.

Think of it this way: AI is the destination, machine learning is the engine. Most of the AI you actually use today — recommendations, translation, voice assistants — is machine learning under the hood.

Where you already meet it

Machine learning is not locked in a lab. It is in ordinary products you use every day:

  • Email spam filters learn which messages you mark as junk and get better over time.
  • Recommendations on Netflix, YouTube and Spotify predict what you will watch or listen to next.
  • Voice assistants like Siri and Alexa use it to understand what you say.
  • Photo apps recognise faces and sort your pictures automatically.
  • Banks use it to spot unusual transactions that might be fraud.
  • Hospitals are testing it to screen medical scans for early signs of disease.

The limits nobody should ignore

Machine learning is powerful, but it has honest limits:

  • Bad data in, bad results out. A model trained on biased or incomplete data will reproduce that bias. This is the old "garbage in, garbage out" rule.
  • It finds patterns, not understanding. A model can predict the next word brilliantly without knowing what any of it means. That is why chatbots can sound confident while being wrong.
  • It needs a lot of data. Most methods need thousands — often millions — of examples to work well.
  • It can be confidently wrong. A model does not know what it does not know, so it can fail on situations unlike anything in its training data.

Takeaway checklist

  • What is machine learning? Software that learns patterns from examples, instead of following hand-written rules.
  • How it learns: Predict, measure the error, adjust, repeat — until the model works on data it has never seen.
  • The three main types: Supervised (labelled examples), unsupervised (finding structure without labels) and reinforcement (trial and error with rewards).
  • Deep learning is machine learning with many-layered neural networks — powerful, but only one part of the field.
  • Machine learning vs AI: AI is the broad goal of intelligent machines; machine learning is the data-driven method that powers most of today's AI.
  • The catch: Models are only as good as their data, they find patterns rather than understanding, and they can be confidently wrong — so check their answers, don't just trust them.

Hamza

Founder & Editor, TechToday

Hamza is the founder and editor of TechToday. Hamza writes about artificial intelligence, computing, security and the technology shaping everyday life, with a focus on explaining complex ideas in plain, honest language — clear answers for curious readers, without the hype.