Confusion Matrix
Quick Start
1. Log Confusion Matrix Data
from sklearn.metrics import confusion_matrix
import json
# Get predictions
y_pred = model.predict(X_test)
# Compute confusion matrix
matrix = confusion_matrix(y_true, y_pred)
# Log to Valohai
print(
json.dumps(
{
"data": matrix.tolist(),
},
),
)Add labels
2. View in Metadata Tab

Complete Example
Binary Classification
Multi-Class Classification
With PyTorch
With TensorFlow/Keras
Troubleshooting
Confusion Matrix Not Appearing
Matrix Shows Wrong Values
Matrix Shape Changes Between Epochs
Next Steps
Last updated
Was this helpful?
