Module 5 — When is a prediction good?
Lesson 1 of 14
Accuracy Isn't Enough
Imagine two artificial intelligence systems.
The first predicts whether tomorrow will be sunny.
The second predicts whether a patient has cancer.
Suppose both systems are 95% accurate.
Are they equally good?
Clearly not.
Being wrong about tomorrow's weather might mean someone unnecessarily carries an umbrella.
Being wrong about a cancer diagnosis could mean a serious illness goes untreated.
This reveals one of the most important ideas in machine learning:
A prediction cannot be judged independently of what happens when the prediction is wrong.
Accuracy matters.
But accuracy alone is not enough.
What do we mean by accuracy?
Suppose we build a machine-learning model that looks at an email and predicts whether it is spam.
The model sees 1,000 emails.
It correctly classifies 950 of them.
Its accuracy is:
so:
or:
95% accuracy.
That sounds excellent.
But the number hides something important.
Which 50 emails did the model get wrong?
Perhaps it occasionally allowed an advertisement into your inbox.
Or perhaps it classified 50 important emails from your employer as spam.
Those systems could have exactly the same accuracy while producing very different outcomes.
Not all mistakes are the same
Consider a medical screening system.
For each patient, the model predicts one of two things:
- disease present;
- disease absent.
There are therefore four possible outcomes.
| Reality | Prediction | Result |
|---|---|---|
| Disease present | Disease present | Correct |
| Disease absent | Disease absent | Correct |
| Disease absent | Disease present | Incorrect |
| Disease present | Disease absent | Incorrect |
The two incorrect outcomes are fundamentally different.
If the model predicts disease when there isn't one, the patient might experience anxiety and undergo unnecessary further testing.
If the model predicts no disease when the patient actually has it, treatment might be delayed.
Both count as one incorrect prediction when calculating accuracy.
But their consequences are not necessarily remotely equivalent.
Machine learning therefore needs ways of evaluating not simply:
How often was the model wrong?
but:
How was it wrong?
and ultimately:
What were the consequences of being wrong?
The problem of the majority
Accuracy has another major weakness.
Imagine a factory produces 10,000 components.
Only 100 are defective.
That means:
- 9,900 are good;
- 100 are defective.
Now imagine we build the world's laziest artificial intelligence system.
Whatever component it sees, it always predicts:
GOOD
It performs no meaningful analysis whatsoever.
Yet it gets 9,900 predictions correct.
Its accuracy is:
We have built a model with 99% accuracy that is completely useless for detecting defective components.
This happens because the classes are imbalanced.
One outcome occurs much more frequently than the other.
The same problem appears in many real systems.
Fraudulent transactions might represent only a tiny fraction of banking activity.
Serious diseases might occur in only a small proportion of a screened population.
Critical equipment failures might be extremely rare.
Dangerous events encountered by an autonomous vehicle might represent a tiny fraction of everything its sensors observe.
Yet these rare cases may be precisely the events we care most about predicting correctly.
The base rate matters
Suppose only 1 person in every 1,000 has a particular disease.
A model that simply predicts:
NO DISEASE
for everybody would be correct 999 times out of 1,000.
Its accuracy would be:
An impressive-looking number.
And a completely useless diagnostic system.
Whenever somebody tells you that a machine-learning system is "99% accurate", therefore, one of your first questions should be:
99% compared with what?
What is the underlying frequency of the thing being predicted?
This frequency is sometimes called the base rate.
Without understanding the base rate, an accuracy number can be deeply misleading.
Compare against a baseline
This leads to another important principle.
A model should rarely be evaluated in isolation.
It should be compared with a sensible baseline.
Suppose we are predicting whether it will rain tomorrow.
If it doesn't rain on 70% of days, then a model that always predicts:
NO RAIN
already achieves 70% accuracy.
A sophisticated machine-learning system achieving 72% accuracy is therefore not necessarily impressive.
The useful question is not simply:
How accurate is the model?
It is:
How much better is the model than the simplest reasonable alternative?
Possible baselines include:
- always predicting the most common outcome;
- predicting tomorrow will resemble today;
- using a simple historical average;
- using an existing human decision process;
- using the system currently deployed.
Machine learning should earn its complexity.
Prediction happens under uncertainty
There is another problem with simply reporting whether a prediction was correct.
Many models don't naturally produce statements such as:
It will rain tomorrow.
They produce something more like:
In other words:
There is a 72% probability of rain tomorrow.
Someone — or some downstream system — may then convert that probability into a decision.
For example:
But why should the threshold be 50%?
Perhaps an outdoor concert organiser cancels only if the probability exceeds 80%.
A farmer deciding whether to irrigate might act at 40%.
Someone deciding whether to carry an umbrella might act at 20%.
The underlying prediction can remain exactly the same.
What changes is the decision rule.
This distinction will become extremely important throughout the course.
A model estimates something about the world. A decision system determines what to do about it.
The threshold changes the errors
Suppose a model estimates the probability that a transaction is fraudulent.
A bank could flag transactions whenever:
Lowering that threshold to:
would probably catch more fraud.
But it would also probably flag more legitimate transactions.
Raising it to:
might inconvenience fewer legitimate customers.
But more fraudulent transactions could escape detection.
There is therefore often no single threshold that simply makes the model "correct".
Instead, we are making a trade-off between different kinds of error.
This is why evaluating a prediction system requires us to understand what happens on both sides of the mistake.
Accuracy compresses information
We can now see the deeper problem with accuracy.
Accuracy takes everything that happened when a model made predictions and compresses it into a single number.
A model might have:
- performed extremely well on common cases;
- failed badly on rare cases;
- produced many false alarms;
- missed several extremely important events;
- performed differently across locations;
- performed differently across groups of people;
- become less reliable as conditions changed.
And yet all of this complexity might be summarised as:
Accuracy: 94.7%
The number isn't necessarily wrong.
It is simply incomplete.
Good according to whom?
There is an even deeper question.
Suppose two models detect fraudulent bank transactions.
Model A
Catches almost every fraudulent transaction but frequently blocks legitimate purchases.
Model B
Rarely blocks legitimate purchases but allows more fraud through.
Which model is better?
That depends partly on whose perspective we consider.
The bank may care about financial losses.
The customer may care about having their card work when they need it.
A regulator may care about consumer protection.
A fraud victim may care about detecting suspicious activity as quickly as possible.
The technical evaluation of a model therefore eventually connects to a broader question:
What outcome are we actually trying to achieve?
This is why model evaluation cannot be completely separated from system design.
Prediction quality is multidimensional
Rather than asking whether a prediction is simply "good", we can ask several different questions.
How often is it correct?
This is the question accuracy tries to answer.
What kinds of mistakes does it make?
Missing an important event may be very different from raising a false alarm.
How confident is it?
A model saying "51% probability" should not necessarily be interpreted in the same way as one saying "99.9% probability".
Is that confidence justified?
If events predicted with 80% probability actually occur around 80% of the time, the model may be well calibrated.
Does it work when conditions change?
A model trained on yesterday's world may encounter a very different world tomorrow.
Does it perform equally well everywhere?
Performance may differ between locations, populations, environments or operating conditions.
What happens when it is wrong?
Ultimately, prediction exists within a larger decision-making system.
From prediction to consequences
This gives us a useful chain:
Prediction → Error → Decision → Action → Consequence
Traditional model evaluation often concentrates heavily on the first two.
But real systems exist because predictions eventually influence decisions and actions.
A weather forecast influences whether a flight departs.
A credit model influences whether someone receives a loan.
A medical model influences whether someone receives further testing.
A demand forecast influences how much electricity infrastructure is scheduled.
A perception model influences whether an autonomous vehicle brakes.
The quality of the prediction therefore cannot always be separated from the consequences produced by the system around it.
There is no universal measure of "good"
This is why machine learning has many evaluation metrics.
Different metrics expose different properties of a model.
Over the rest of this module we will encounter measures including:
- mean absolute error;
- mean squared error;
- precision;
- recall;
- false-positive rates;
- false-negative rates;
- confusion matrices;
- ROC curves;
- calibration;
- probabilistic scoring rules.
None is universally best.
Each asks a slightly different question.
The appropriate measure depends on:
- what we are predicting;
- how common different outcomes are;
- which mistakes matter;
- how predictions will be used;
- what happens when the model is wrong.
Choosing an evaluation metric is therefore not merely a mathematical exercise.
It is partly a statement about what we value.
The bigger idea
Earlier in the course we introduced loss functions.
Before a machine can learn, somebody has to define what counts as being wrong.
Evaluation introduces the corresponding question:
Once the machine has learned, how do we decide whether it is good enough?
Again, mathematics can help us measure performance.
But mathematics cannot independently decide which consequences society, an organisation or an individual should care about.
A prediction model sits inside a larger system:
DATA → MODEL → PREDICTION → DECISION → ACTION → CONSEQUENCE
Evaluating the model therefore requires us to look beyond the prediction itself.
The central lesson is simple:
Accuracy tells us how often a model is right. It does not tell us whether the model is useful, whether its mistakes are acceptable, or whether the system built around it produces good outcomes.
Accuracy is a useful place to start.
It is a terrible place to stop.