Understanding Training, Testing, Actual & Predicted Values
Apple Example
Think of a Machine Learning Model as a Child
A machine learning model is like a child who does not know anything initially.
Just like a child:
- The model must be taught
- The model must then be tested
Training Phase – Teaching the Child
You start teaching the child using fruits.
You show a fruit and ask:
“What fruit is this?”
The child answers something:
- Maybe “Apple”
- Maybe “Banana”
This answer is called the predicted value
Because it is the child’s guess.
You immediately tell the child:
“The correct answer is APPLE 🍎”
This correct answer is called the actual value.
So during training:
- Child gives a predicted value
- Human provides the actual value
- Child learns by comparing both
This process repeats many times.
What Exactly Is Training Data?
The apples you show during teaching are called training data.
Training data means:
Data used to teach the model, along with correct answers (actual values)
Error – How Learning Happens
If:
- Predicted value = Apple
- Actual value = Apple
→ No error
If:
- Predicted value = Banana
- Actual value = Apple
→ Error happened
Error = Difference between predicted and actual value
During training:
- Error is used to improve learning
Testing Phase – Exam Time (New Apple 🍎)
Now the exam starts.
You show a new apple:
- The child has never seen this exact apple
- But it is still an apple
This new apple is called test data.
You ask:
“What fruit is this?”
The child answers:
“Apple”
This answer is again a predicted value.(but during testing)
Step 1: What Happens During the Exam?
Even in the exam:
- Humans already know the correct answer
- The fruit is actually an apple
That correct answer is still called the actual value.
But now:
- We do not tell the child the answer
- We do not help the child learn
- We only observe what the child answers
Step 2: Observing One Answer Is Not Enough
Suppose:
- One apple → child says “Apple” ✔
Can we conclude:
“The child has learned perfectly”?
❌ No.
Because:
- Maybe it was luck
- Maybe it remembered only one apple
Step 3: Many Exam Questions (Many Test Data)
So in an exam:
- We ask many questions
- Not just one apple
Example:
- Apple 1 → correct
- Apple 2 → wrong
- Apple 3 → correct
- Apple 4 → wrong
Now the big question:
“Overall, how well did the child perform?”
How Humans Measure Exam Performance
In school:
- We don’t check question by question
- We calculate marks, percentage, grade
That single score tells:
- How good the performance is
- Whether the child passed or failed
Machines Need the Same Thing
In machine learning:
- The model predicts on many test data points
- For each one:
- We know the actual value
- We get a predicted value
We need:
One or a few numbers to summarize performance
This Summary Is Called a Performance Metric
What Is a Performance Metric? (Slow Introduction)
A performance metric is:
- A numerical measure
- That summarizes how accurate the model is
- Based on errors on test data
It answers:
- How close are predictions to actual values?
- Is the model reliable?
- Is this model better than another one?
Apple Example → Performance Metric
| Actual (Human Truth) | Predicted (Child) |
| Apple | Apple |
| Apple | Banana |
| Apple | Apple |
| Apple | Apple |
Instead of checking one by one, we say:
“Child answered 3 out of 4 correctly.”
That score is like a performance metric.
From Apple to Regression
In regression:
- Instead of correct / wrong
- We measure how far the prediction is
Example:
- Actual price = ₹45 lakh
- Predicted = ₹50 lakh
- Error = ₹5 lakh
Performance metrics combine many such errors.
Training vs Testing — Final Clear Explanation
(Learning Phase vs Exam Phase)
Training Phase = Learning Phase
In the training phase, the model is learning, just like a child in class.
What happens?
- The model predicts an answer
- Humans already know the actual value
- The model compares:
- Predicted value
- Actual value
- The difference (error) is used to improve learning
Actual values are used to TEACH the model
Just like:
A teacher corrects the child after each question in class
Testing Phase = Exam Phase
In the testing phase, the model is examined, not taught.
What happens?
- The model predicts on new data
- Humans still know the actual value
- BUT:
- The model is not corrected
- No learning happens
- We only observe predictions
Actual values are used only to CHECK performance
Just like:
Teachers already know the answers in exams, but they only calculate marks
Why Performance Metrics Are Calculated on Test Data
Now make this conclusion very explicit:
Performance metrics are calculated on test data, not training data.
Why?
- Training data is for learning
- Test data is for evaluation
- Test data shows real ability
Same logic as:
- Classwork → learning
- Exam → performance
Final Comparison Table
| Aspect | Training Phase | Testing Phase |
| Purpose | Learning | Evaluation |
| Data used | Training data | Test data |
| Predicted values | Yes | Yes |
| Actual values used | Yes (for correction) | Yes (for checking only) |
| Learning happens | Yes | No |
| Performance metrics | No | Yes |
Actual values are used during training to improve the model’s learning, while during testing they are used only to evaluate performance using performance metrics.
In exams,
teachers calculate:
- Marks
- Percentage
- Grade
That single number tells:
- How well the student performed overall
Same Question for Machine Learning Models
After testing the model on many test data points, we ask:
- Is the model good or bad?
- How big are its mistakes?
- Is Model A better than Model B?
- Are mistakes small or dangerous?
We cannot judge by looking at individual predictions.
This Is Where Regression Metrics Come In
Regression performance metrics are numerical scores that summarize how well a regression model predicts real-world numerical values.
Just like:
- Marks summarize exam performance
Regression metrics summarize:
- Errors made by the model on test data
Why ONLY Test Data? (Clear & Final)
Make this point very clear to avoid confusion:
✔ Training data is used for learning
✔ Test data is used for evaluation
✔ Performance metrics are calculated on test data
Same logic as:
- Classwork → learning
- Exam → marks
House Price – Regression
- Actual house price = ₹45 lakh (human knows)
- Predicted house price = ₹50 lakh (model guesses)
- Error = ₹5 lakh
Now imagine:
- 100 houses
- 100 such predictions
- 100 errors
How do we summarize all these errors?
Using regression metrics like:
- MAE
- RMSE
- R²
- MAPE
