Код: Выделить всё
def plot_confusion_matrix(y_true, y_pred, class_names):
confusion_matrix = metrics.confusion_matrix(y_true, y_pred)
confusion_matrix = confusion_matrix.astype(int)
layout = {
"title": "Confusion Matrix",
"xaxis": {"title": "Predicted value"},
"yaxis": {"title": "Real value"}
}
fig = go.Figure(data=go.Heatmap(z=confusion_matrix,
x=class_names,
y=class_names,
hoverongaps=False),
layout=layout)
fig.show()
[img]https:/ /i.sstatic.net/ow411.png[/img]
Как показать число внутри соответствующей ячейки, а не наводить его, как показано ниже

Подробнее здесь: https://stackoverflow.com/questions/608 ... -a-heatmap