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.

Splitting the data
Never evaluate a model on the data it was trained on. The standard discipline is three sets:
- Training set (~70β80%) β the model learns from these examples.
- Validation set β used during development to tune choices (algorithm, hyperparameters).
- Test set β touched once, at the end, to estimate real-world performance. If you tune against it repeatedly, it silently becomes a second validation set and your estimate is optimistic.
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 |
- Precision = of the claims we flagged, how many were really fraud? (TP / (TP + FP)). Low precision = investigators drowning in false alarms and citizens wrongly accused.
- Recall = of the actual fraud, how much did we catch? (TP / (TP + FN)). Low recall = fraud sailing through undetected.
- F1 score = the harmonic mean of precision and recall β a single number that punishes neglecting either one.
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.