MACHINE LEARNING • LESSON 3

Evaluating Predictions

A machine learning model can make predictions, but a prediction is not automatically correct. We need to compare the model's predictions with the actual results to understand how well the model is performing.

THE CORE IDEA

A prediction is useful only if we know how well it performs.

Evaluation means checking the model's predictions against the correct or actual results. This helps us understand whether the model is making useful predictions or needs improvement.

01

Prediction vs Evaluation

These are two different steps in machine learning.

PREDICTION What does the model think?

The trained model receives new data and produces an output.

EVALUATION How good was that prediction?

We compare the prediction with the actual result to measure performance.

New Data Model Prediction Compare With Actual Result Evaluate
02

Simple House Price Example

Suppose a model predicts the price of a house.

The model predicts: $350,000

Later, we discover that the actual selling price was: $370,000

MODEL PREDICTION $350,000
vs
ACTUAL PRICE $370,000

The prediction was not exactly correct.

The difference between the predicted value and the actual value gives us information about the model's performance.

Simple idea:

Prediction tells us the model's answer. Evaluation tells us how close or useful that answer was.

03

One Prediction Is Not Enough

We should not judge a model based on just one prediction.

Imagine a model makes these predictions:

House Predicted Actual
House 1 $300,000 $310,000
House 2 $400,000 $395,000
House 3 $250,000 $320,000
House 4 $500,000 $490,000

Now we can look at several predictions together and get a better idea of how the model performs overall.

This is why machine learning evaluation normally uses multiple examples rather than relying on one prediction.

04

What Are We Looking For?

When evaluating a model, we want to understand whether its predictions are close to the correct results and whether it performs consistently on data it has not learned from.

ACCURATE Are predictions close to the correct answers?
CONSISTENT Does the model perform well across many examples?
GENERALIZES Does it work well on new data?
05

Classification Example

Evaluation also works when the model predicts categories instead of numbers.

Suppose a model predicts whether emails are Spam or Not Spam.

ACTUAL Spam
MODEL PREDICTION Spam
Correct
ACTUAL Not Spam
MODEL PREDICTION Spam
Incorrect

By comparing many predictions with their actual labels, we can understand how well the classifier is working.

Later, we will learn specific metrics such as accuracy, precision, recall, and F1 score.

06

Why Can't We Evaluate Using Training Data?

This is an important idea.

A model has already seen the training examples while learning. If we only test it on those same examples, the result may give us a misleading picture of how well it works on new data.

TRAINING DATA Model has already seen it

The model learned from these examples during training.

NEW / TEST DATA Model has not learned from it

This gives us a better idea of how the model performs on unseen examples.

This is one reason machine learning workflows separate training data from data used for evaluation.

07

Evaluation Helps Us Improve the Model

Suppose we evaluate a model and discover that its predictions are poor.

That tells us something important: the current model or the current data preparation may not be good enough.

1 Train Model
2 Make Predictions
3 Evaluate
4 Improve

We can then make changes and train again.

This creates an iterative machine learning workflow.

08

A Complete Simple Example

Let's put everything together using house-price prediction.

DATA Existing houses
TRAIN Model learns patterns
PREDICT Predict new houses
EVALUATE Compare predictions

If the predictions are good, the model may be useful.

If the predictions are poor, we need to investigate why and improve the model or the data.

KEY IDEA

Evaluation Tells Us How Well the Model Is Performing.

We compare the model's predictions with actual results and use multiple examples to understand whether the model is accurate, reliable, and useful on new data.

QUICK CHECK

Which Model Is Better?

Two house-price models make predictions for the same group of new houses.

Model A usually predicts prices very close to the actual selling prices.

Model B often predicts prices that are far away from the actual selling prices.

Answer

Model A is performing better because its predictions are closer to the actual results.

In real machine learning, we use specific evaluation metrics to measure this difference more precisely.

NEXT TOPIC

Improving the Model

Evaluation tells us how well the model is performing. Next, we will look at what we can do when the model is not performing well enough.