Model Pipeline - Confusion matrix analysis
This pipeline shows how a model learns to classify data and how we use a confusion matrix to understand its mistakes and successes.
This pipeline shows how a model learns to classify data and how we use a confusion matrix to understand its mistakes and successes.
Loss
1.2 |*****
0.9 |****
0.7 |***
0.5 |**
0.4 |*
+---------
Epochs 1-5| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 1.2 | 0.45 | Model starts learning, accuracy low |
| 2 | 0.9 | 0.60 | Loss decreases, accuracy improves |
| 3 | 0.7 | 0.72 | Model learns important patterns |
| 4 | 0.5 | 0.80 | Good improvement, model stabilizing |
| 5 | 0.4 | 0.85 | Training converging, accuracy high |
import tensorflow as tf true_labels = [0, 1, 2, 2, 0] pred_labels = [0, 2, 2, 2, 0] cm = tf.math.confusion_matrix(true_labels, pred_labels) print(cm.numpy())
import tensorflow as tf true = [0, 1, 1, 0] pred = [0, 1, 0] cm = tf.math.confusion_matrix(true, pred) print(cm)
[[50 2 3] [ 4 45 1] [ 5 2 40]]Which class has the highest precision, and how do you calculate it from the matrix?
Pass the test and this pattern moves unknown