What is Machine Learning?
The one-line idea
Machine learning is teaching a computer to find patterns from examples instead of being told the exact rules to follow.
In ordinary programming, a human studies a problem, works out the rules, and writes them down as code. That works beautifully for tax calculators and traffic lights — problems where the rules are knowable and few. But how do you write the rules to tell a cat from a dog in a photo, or spam from a real email? Nobody can list every rule. Machine learning sidesteps that: you hand the computer thousands of labelled examples and let it infer the rules on its own.
Show a program enough examples of a task, and it learns a model — a rule of thumb — that generalises to new, unseen cases.
The paradigm flip
This is the single most important idea to internalise. Traditional programming and machine learning consume and produce different things.
- You provide rules + data
- The computer produces answers
- The human does the thinking up front
- You provide data + answers
- The computer produces the rules (a model)
- The data does the thinking for you
The animation below walks through that flip, then shows the two phases every ML system has: training (learn the rules from examples) and inference (use the rules on something new).
A concrete example — the spam filter
Imagine building a spam detector. The hand-written approach quickly drowns: if "free money" → spam, if "viagra" → spam … spammers just change the words. The ML approach instead collects a pile of emails already marked spam or not spam, and lets the model discover which combinations of words, senders, and patterns tend to mean spam.
Thousands of past emails, each as raw text plus a few features.
The known correct answer for each example — what we want to predict.
What training produces: a function from a new email to a spam probability.
The three broad types
Almost every ML problem falls into one of three families, set apart by what kind of feedback the model gets while learning.
Examples come with the right answer. Predict a number (regression) or a category (classification).
No labels — group similar items or compress the data and let the patterns surface.
An agent acts, gets rewards or penalties, and improves its strategy over time.
The next article, Types of Machine Learning, unpacks each family with its own examples.
When to reach for ML — and when not to
- The rules are too complex to write by hand (images, language)
- Patterns change over time and rules would go stale
- You have lots of examples of the right answer
- A few clear rules already solve it perfectly
- You have almost no data to learn from
- Mistakes are unacceptable and the model can't explain itself
The takeaway
Machine learning is not magic — it is pattern-fitting at scale. You curate examples, choose a model, let training tune the model to those examples, and then trust it (carefully) on new data. Everything else in this section — regression, trees, clustering, neural networks — is just a different way of fitting those patterns.