Training vs Prediction
We now know what a Machine Learning model is. The next important step is understanding what happens before a model can make predictions and what happens when we actually use it.
During training, the model learns from data. During prediction, the trained model is used to produce an output for new data.
The Big Difference
Learn From Data
The learning algorithm uses training examples to determine a useful model.
Use the Model
The trained model receives new input and produces an output.
What Happens During Training?
Training is the learning stage.
We provide the algorithm with examples from which it can learn useful relationships.
Examples containing information relevant to the problem.
Searches for a useful relationship in the training data.
The learned result that can later be used for predictions.
Example: Training a House Price Model
Suppose we have historical house data.
The learning algorithm examines these examples and learns a relationship between house information and price.
What Happens During Prediction?
Prediction happens after we already have a trained model.
We give the model new information and ask it to produce an output.
A house the model has not seen during training.
The model uses its learned relationship.
An estimated result is produced.
The Most Important Difference
The algorithm uses examples to determine the learned values that form the model.
The trained model takes new input and produces an output.
Prediction Does Not Mean Retraining
This is a common beginner confusion.
Suppose the model has already been trained. We then give it one new house.
The model uses what it already learned to produce a prediction.
Think of Machine Learning as Two Main Phases
Learn
Use training data to learn a model.
Use
Use the trained model on new data.
Example 1: Spam Detection
Give the algorithm many emails labeled as spam or not spam.
The trained model represents patterns useful for distinguishing the categories.
The model predicts whether the new email is spam.
Example 2: Customer Purchase Prediction
Customer information and whether they purchased a product.
A model that can estimate purchase behavior.
Estimate whether the customer is likely to purchase.
Training and Prediction Can Have Different Costs
Training can require significant computation, especially when the dataset or model is large.
Once a model is trained, making an individual prediction can often be much faster.
The system is learning from many examples and adjusting the model.
New input is passed through the already trained model.
Does a Model Ever Need to Be Trained Again?
Yes.
If new data becomes available or the real-world relationship changes, we may need to retrain or update the model.
But this is different from prediction itself. Prediction simply uses the current trained model.
Common Beginner Confusion
Not normally. Prediction uses the trained model. Learning happens during training.
No. Training data contains examples. The model is the learned result produced from those examples.
Training teaches the model. Prediction uses the model.
Training uses examples to create a learned model. Prediction takes new input and passes it through that trained model to produce an output.
The Complete Flow
Past examples
Learn patterns
Learned relationship
New data
Output