You can easily generate confusion matrices in Valohai.
The supported formats are:
- An array of
[['x', 'y', v], ['x', 'y', v], ...]
triples (i.e. x label, y label, value) - A 2-dimensional array of the shape
[[v, v, v], [v, v, v], ...]
- A 2-dimensional array with a header for labels
[['a', 'b', 'c'], [v, v, v], [v, v, v], ...]
Python Example
from sklearn.metrics import confusion_matrix
import numpy as np
import json
y_actu = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
matrix = confusion_matrix(y_actu, y_pred)
# Convert to list
result = matrix.tolist()
print(json.dumps({"data": result}))
# {"data": [[3, 0, 0], [0, 1, 2], [2, 1, 3]]}
Would result in: