How to print classification report and confussion matrix?

Hi,
I am trying to implement confuson matrix and classification report after the test phase.
However, both metrices is not appeared in the panel.
In the charts section in my pannel, it says
Selected runs are not logging media for the key **classification_report**, but instead are logging values of type **string**.

Any recommendation to print them ?

Hi @arslan-erdo, thanks for reaching out with your question. You should be able to log the Confusion Matrix and the Classification Report adjusting the following snippet of code:

import wandb
from sklearn.metrics import classification_report

entity = ""
project = ""

run = wandb.init(entity=entity, project=project)

true_labels = [ 0, 0, 0, 1, 2, 1, 0, 2, 1]
pred_labels = [ 0, 0, 0, 1, 1, 1, 2, 2, 2]
class_names = ["Class-0", "Class-1", "Class-2"]

report_columns =  ["Class", "Precision", "Recall", "F1-score", "Support"]
class_report = classification_report(true_labels,pred_labels,target_names=class_names).splitlines()

report_table = []
for line in class_report[2:(len(class_names)+2)]:
    report_table.append(line.split())

run.log({
    "Confusion Matix": wandb.plot.confusion_matrix(y_true=true_labels, preds=pred_labels, class_names=class_names),
    "Classification Report": wandb.Table(data=report_table, columns=report_columns)
    })

You can see how this would look like in this project.

Let me know if you have any questions on this.