Machine learning is a branch of artificial intelligence in which computers improve their performance on a task by finding patterns in data — rather than by following explicit, hand-written instructions for every possible situation. When your email filter catches a new kind of spam, or a translation app handles a sentence it has never seen before, machine learning is doing the work.

This guide explains what machine learning actually is, how it differs from traditional programming, the three main types of learning, how neural networks work, and where you already encounter ML every day — along with its real limitations. For a deeper look at how AI systems improve themselves, see our guide on how artificial intelligence learns.

Learning from data instead of rules

In traditional programming, a developer writes the rules: if this, then that. Every decision the program makes was anticipated by a human. In machine learning, the developer provides examples and a learning algorithm, and the system derives its own rules. Show a model thousands of labelled emails, and it learns to distinguish spam from legitimate mail — including tricks its programmers never anticipated.

A classic example is image recognition. Nobody could write explicit rules for "what makes a cat look like a cat" — the variations in lighting, angle, breed and background are endless. But feed a model millions of labelled cat and dog photos, and it discovers the statistical patterns itself. The rules it learns are stored as millions of adjustable numbers, not as human-readable instructions.

A brief history

Machine learning is older than most people think. In the 1950s, Arthur Samuel wrote a checkers-playing program that improved with experience — he coined the term "machine learning." The 1980s and 1990s brought practical algorithms for tasks like handwriting recognition. Progress was slow for decades because computers lacked the processing power and data that modern methods need. That changed in the 2010s: graphics processors (GPUs), enormous datasets, and deep neural networks combined to produce the breakthroughs behind today's voice assistants, translation tools and image generators.

The three main types of machine learning

1. Supervised learning

Supervised learning trains on labelled examples — data where the correct answer is already known. Photos tagged "cat" or "dog," emails marked "spam" or "not spam," house listings paired with their sale prices. The model learns to predict labels for new, unseen inputs. This is the most widely used type, powering everything from fraud detection to medical diagnosis support.

2. Unsupervised learning

Unsupervised learning looks for structure in unlabelled data, where no correct answers are provided. It might group customers with similar buying behaviour, or find that news articles naturally cluster into topics. It's discovery rather than prediction — the algorithm finds patterns humans didn't know to look for.

3. Reinforcement learning

Reinforcement learning trains an agent through trial and error, rewarding actions that lead to good outcomes — much like training a dog with treats. The approach is behind game-playing AIs that mastered chess and Go, and it's used in robotics, where a simulated robot arm learns to grasp objects through millions of practice attempts. No labelled dataset is needed; the environment itself provides feedback.

Neural networks: the engine behind modern ML

Many of today's most capable systems use neural networks — models loosely inspired by the brain, built from layers of simple processing units ("neurons"). Data flows in through an input layer, passes through hidden layers that transform it step by step, and exits as a prediction. During training, the network compares its predictions with the correct answers and adjusts the strength of connections between neurons — a process called backpropagation — gradually reducing its errors.

Deep learning simply means neural networks with many layers. Depth lets the network learn hierarchical patterns: in image recognition, early layers detect edges, middle layers detect shapes like eyes or wheels, and later layers assemble those into "face" or "car." This hierarchy is why deep learning excels at complex, messy data like images, speech and language.

Training vs inference: learning, then doing

Machine learning has two distinct phases. Training is the expensive learning phase: the model processes vast amounts of data, makes predictions, measures errors and adjusts itself — often requiring powerful hardware running for days or weeks. Inference is the cheap doing phase: the trained model makes predictions on new data, which can happen in milliseconds on an ordinary phone. This split is why a voice assistant can answer instantly even though teaching it took enormous computing power.

Machine learning vs deep learning vs AI

These terms are often used interchangeably, but they describe nested ideas:

TermWhat it meansExample
Artificial intelligenceThe broad field: any technique that lets machines perform tasks requiring intelligenceA chess program, a chatbot
Machine learningA subset of AI: systems that improve by learning patterns from dataA spam filter, a recommendation engine
Deep learningA subset of ML: machine learning using multi-layered neural networksImage recognition, language models

All deep learning is machine learning, and all machine learning is AI — but not all AI uses machine learning. A chess engine from the 1990s was AI built from hand-coded rules, with no learning involved.

Overfitting and underfitting: two ways to fail

A model can fail in two opposite ways. Underfitting means it hasn't learned enough — like a student who skimmed the textbook and can't answer detailed questions. Overfitting means it memorized the training data too precisely, including its noise and quirks — like a student who memorized past exam papers word-for-word but can't handle a new question. Good machine learning finds the middle ground: learning genuine patterns that generalize to new data. Practitioners test models on data they never trained on to check this.

Where you encounter machine learning daily

Machine learning is embedded in everyday products: search ranking, recommendation feeds, voice assistants, fraud detection on your bank card, medical image screening, translation, predictive text and navigation ETAs. Behind the scenes it also optimizes logistics routes, balances energy grids, predicts equipment failures in factories and screens job applications. If a digital product seems to "know" something about you, a machine learning model is usually involved — which is also why protecting your data online matters more than ever.

Limitations and risks

Machine learning has real, well-documented limits. A model's abilities are bounded by its training data: biased, incomplete or stale data produces biased, unreliable predictions — the principle of "garbage in, garbage out." Systems also struggle with situations unlike anything in their training data, which is why human oversight remains essential for high-stakes decisions like medical diagnosis or criminal justice.

Other risks include hallucination (generative models confidently stating falsehoods), vulnerability to adversarial manipulation (tiny, invisible changes to an image that fool a classifier), and privacy concerns when models memorize sensitive training data. Understanding these limits is as important as understanding the capabilities.

Learning machine learning: where to start

Getting started requires no advanced degree, but it does help to be comfortable with basic programming (Python is the standard language) and high-school-level maths — particularly statistics and linear algebra. Free courses from major universities and interactive tutorials can take a beginner from zero to building a first classifier in weeks. The most effective approach is project-based: pick a real dataset, try to predict something, and learn the theory as obstacles arise.