When training a model, the key metric is the loss. Loss tells us how far the model's predictions are from the true answers. Training changes the model's weights to make this loss smaller. A smaller loss means the model is learning better and making more accurate predictions.
0
0
Why training optimizes model weights in TensorFlow - Why Metrics Matter
Metrics & Evaluation - Why training optimizes model weights
Which metric matters and WHY
Confusion matrix or equivalent visualization
For classification tasks, the confusion matrix shows how many predictions were correct or wrong:
| Predicted Positive | Predicted Negative |
|--------------------|--------------------|
| True Positive (TP) | False Positive (FP) |
| False Negative (FN) | True Negative (TN) |
Training adjusts weights to increase TP and TN, and reduce FP and FN, improving accuracy and other metrics.
Precision vs Recall tradeoff with examples
Training optimizes weights to balance precision and recall. For example:
- In spam detection, high precision means fewer good emails marked as spam.
- In disease detection, high recall means fewer sick people missed.
Training changes weights to find the best balance for the task.
What good vs bad metric values look like
Good training results show:
- Low loss value (close to zero)
- High accuracy, precision, and recall (close to 1.0)
Bad results show high loss and low accuracy or unbalanced precision/recall.
Common pitfalls in metrics
- Accuracy paradox: High accuracy can be misleading if data is imbalanced.
- Data leakage: Training on data that leaks test info inflates metrics falsely.
- Overfitting: Very low training loss but poor test performance means model memorizes, not learns.
Self-check question
Your model has 98% accuracy but only 12% recall on fraud cases. Is it good for production? Why or why not?
Answer: No, it is not good. The model misses most fraud cases (low recall), which is dangerous. High accuracy is misleading because fraud is rare. The model needs better recall to catch fraud.
Key Result
Training optimizes model weights to minimize loss, improving prediction accuracy and balancing precision and recall.