Traditional software follows rules written by programmers. Machine learning flips that: instead of writing the rules, we show the computer many examples and let it find the patterns itself.

A simple example

Imagine sorting email into “spam” and “not spam”. Writing rules by hand (“if the message contains free money…”) quickly becomes impossible. A machine learning system instead looks at thousands of emails already labelled by people and learns which features tend to signal spam. When a new email arrives, it applies what it learned.

The three main types

  1. Supervised learning — learning from labelled examples. Photos labelled “cat” or “dog” → a model that recognizes cats and dogs.
  2. Unsupervised learning — finding structure in unlabelled data. Grouping customers with similar shopping habits.
  3. Reinforcement learning — learning by trial and error with rewards. A program that learns to play a game by being rewarded for winning.

What “training” means

During training, the model makes predictions, compares them with the right answers and adjusts its internal numbers (called parameters) to make fewer mistakes. Repeat this millions of times and the model becomes good at the task — as long as the examples represent the real world well.

Where you already use it

  • Recommendations on streaming and shopping sites
  • Spam filters and fraud alerts
  • Photo search on your phone
  • Voice assistants and automatic subtitles
  • Navigation apps predicting traffic

Its limits

A model is only as good as its data. If the examples are biased or incomplete, the model will be too. And a model trained for one task usually cannot do another without new training.

Machine learning is the foundation of today’s generative AI, which learns from huge amounts of text, images and audio in order to create new content.

A worked example: predicting house prices

Suppose you have data on 1,000 sold houses: size, number of rooms, location and sale price.

  1. Split the data: use 800 houses for training and keep 200 aside for testing.
  2. Train a model: the algorithm finds patterns linking features to prices — larger houses in certain areas sell for more.
  3. Test it: predict prices for the 200 unseen houses and compare with actual prices.
  4. Measure error: for example, the average difference between predicted and actual prices.
  5. Use it: estimate prices for new houses — and keep checking accuracy as the market changes.

This is supervised learning: the model learns from examples with known answers.

Common terms

  • Features: the input information (size, rooms, location).
  • Label: the answer to predict (price).
  • Overfitting: when a model memorizes training data and performs poorly on new data.
  • Validation and test sets: data held back to check performance honestly.
  • Algorithm vs. model: the algorithm is the learning method; the model is the result after training.

Machine learning, deep learning and AI

Artificial intelligence is the broad goal of making machines perform tasks that require intelligence. Machine learning is the dominant approach: learning from data rather than following hand-written rules. Deep learning is a type of machine learning using neural networks with many layers, behind today’s language models, image generators and speech recognition.

Continue with what generative AI is, the math you need for AI and our gradient descent example.

Try it

Free tools let you train a simple image classifier in your browser in minutes — a great first experiment.

What to watch next

  • Tools that let non-programmers build machine learning models.
  • Foundation models replacing many task-specific models.
  • Regulation of automated decisions made with machine learning.
  • Machine learning on devices for privacy and speed.

Key takeaways

  • Machine learning lets computers learn patterns from data instead of following explicit rules.
  • The main types are supervised, unsupervised and reinforcement learning.
  • Training adjusts a model to reduce errors on examples.
  • Testing on unseen data shows whether a model generalizes.
  • Deep learning is a subset of machine learning that powers modern AI.

Frequently asked questions

Is machine learning the same as AI?

Machine learning is the main approach used in AI today, but AI also includes other methods.

Do I need to code to use machine learning?

Not necessarily. Many tools offer no-code machine learning, though coding gives more control.

What is overfitting?

When a model learns the training data too closely, including noise, and performs poorly on new data.