LyraLearn AI Learning Platform
Exams
← Module 19 Β· Machine Learning Foundations
🎧 Listen

Training and Evaluation

A model is only as trustworthy as its evaluation. This lesson covers the split-train-evaluate discipline and the four metrics every AI-900/AI-102 candidate β€” and every architect signing off on a model β€” must be able to explain without notes.

A confusion matrix showing why accuracy misleads on imbalanced data, with precision and recall highlighted as opposing measurement directions and a slider showing their trade-off.

Splitting the data

Never evaluate a model on the data it was trained on. The standard discipline is three sets:

Two failure modes frame every training conversation. Overfitting: the model memorizes the training data β€” near-perfect training scores, poor test scores. It learned the noise, not the pattern. Underfitting: the model is too simple to capture the pattern β€” poor scores everywhere. The fix directions are opposite (more data/regularization/simpler model vs. richer features/more capacity), which is why exams test that you can tell them apart from the scores.

Why accuracy lies: fraudulent claims

Suppose a public-sector benefits system sees 1% fraudulent claims. A "model" that predicts every claim is legitimate scores 99% accuracy β€” and catches zero fraud. With class imbalance, accuracy is the wrong lens. You need metrics that look at each error type separately, via the confusion matrix:

| | Predicted fraud | Predicted legitimate | |------------------|----------------|----------------------| | Actually fraud | True Positive | False Negative (missed fraud) | | Actually legit | False Positive (wrongly flagged) | True Negative |

Choosing the metric is an architecture decision

Precision and recall trade off against each other via the model's decision threshold: flag more aggressively and recall rises while precision falls. Which to favor is a business call, not a data-science one. Cancer screening or fraud triage with a human reviewer downstream: favor recall β€” a miss is costly, a false alarm is reviewable. Auto-blocking payments or suspending accounts with no human in the loop: favor precision β€” a false positive directly harms someone. The exam phrasing to remember: "minimize missed cases" β†’ recall; "minimize false alarms" β†’ precision; "balance both on imbalanced data" β†’ F1, never raw accuracy.

🧠 Quiz yourself on this lesson →

Ask the AI Tutor

Grounded in the course lessons β€” it cites its sources and says when it doesn't know.