MACHINE LEARNING • LESSON 3

Making Predictions

After a model has been trained, we can give it new data and ask it to produce an answer. This process is called making a prediction.

THE CORE IDEA

A trained model uses what it learned to answer new questions.

During training, the model learns patterns from existing examples. During prediction, we give the trained model new input that it has not seen before, and it uses those learned patterns to produce an output.

01

Training vs Prediction

These two stages are different.

TRAINING Learn from examples

The model receives data and learns patterns from it.

PREDICTION Use what was learned

The trained model receives new data and produces an answer.

Training Data Training Trained Model New Data Prediction
02

What Is a Prediction?

A prediction is the output produced by a trained machine learning model when it receives new input.

The output depends on the type of machine learning problem.

REGRESSION A number

Example: Predicting a house price of $350,000.

CLASSIFICATION A category

Example: Predicting that an email is Spam.

OTHER ML TASKS Different outputs

The output depends on what the model was designed to predict.

03

Example: Predicting a House Price

Suppose we trained a model using thousands of houses.

The model learned relationships between information such as house size, bedrooms, location, and price.

Now we have a new house:

NEW HOUSE 1,800 sq ft

3 bedrooms

TRAINED MODEL Uses learned patterns
PREDICTION $350,000

The model has never seen this exact house before. It uses the patterns learned during training to estimate its price.

Important:

The predicted price is an estimate produced by the model. It is not automatically the true selling price.

04

Example: Spam Detection

Prediction does not always mean predicting a number.

Consider a spam detection model.

During training, the model was given many emails labelled as Spam or Not Spam.

Now a new email arrives.

NEW EMAIL "Congratulations! You won..."
TRAINED MODEL Examines learned patterns
PREDICTION Spam

Here the model predicts a category instead of a numerical value.

05

The Model Does Not "Know" the Future

The word prediction can sometimes be misleading.

A machine learning model does not magically know what will happen in the future.

It uses patterns learned from existing data to estimate an output for new input.

WRONG IDEA The model knows the future

A model cannot guarantee that its prediction will be correct.

BETTER IDEA The model estimates an outcome

It uses learned patterns to produce the most appropriate output it can.

06

One Model Can Make Many Predictions

Once a model has been trained, we can normally use it to make predictions for many new examples.

For example, a house-price model can receive different houses one after another.

HOUSE 1 $280,000
HOUSE 2 $410,000
HOUSE 3 $325,000
HOUSE 4 $510,000

The same trained model can process each new house and produce a prediction.

07

Prediction in a Real Application

Machine learning predictions are often used inside applications.

For example, an e-commerce website could use a trained model to predict whether a customer is likely to buy a product.

CUSTOMER Visits website
CUSTOMER DATA Viewed products, history
MODEL Makes prediction
RESULT Likely to purchase

The application can then use that prediction for whatever business decision it was designed to support.

08

Prediction Is Not the End

After a model makes predictions, we need to determine how good those predictions actually are.

For example, if a model predicts a house price of $350,000 and the actual selling price is $370,000, we can measure the difference.

PREDICTED $350,000
vs
ACTUAL $370,000
NEXT STEP Evaluate the prediction

This leads to the next stage of the machine learning workflow: evaluating predictions.

KEY IDEA

Prediction Means Using a Trained Model on New Data.

The model does not simply memorize an answer. It uses patterns learned during training to produce an output for new input. That output may be a number, a category, or another type of result depending on the ML problem.

QUICK CHECK

What Is Happening Here?

A house-price model was trained using 50,000 existing houses.

A new 2,000 sq ft house is given to the already-trained model, and the model predicts a price of $420,000.

Answer

This is a prediction.

The model has already learned patterns from the training data. It is now using those learned patterns to estimate the price of a new house.

NEXT TOPIC

Evaluating Predictions

A prediction is only useful if it performs well. Next, we will learn how to compare predictions with actual results and determine how well a model performs.