Open kasrahabib opened 11 months ago
I think there is a small mistake in the code while calling the function for plot_confusion_matrix(y_preds, y_true, labels)
plot_confusion_matrix(y_preds, y_true, labels)
The problem arises in chapter:
from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix def plot_confusion_matrix(y_preds, y_true, labels): cm = confusion_matrix(y_true, y_preds, normalize="true") fig, ax = plt.subplots(figsize=(6, 6)) disp = ConfusionMatrixDisplay(confusion_matrix=cm, display_labels=labels) disp.plot(cmap="Blues", values_format=".2f", ax=ax, colorbar=False) plt.title("Normalized confusion matrix") plt.show()
Here is the next line that, I think, contains the mistake, where you call the function:
plot_confusion_matrix(df_tokens["labels"], df_tokens["predicted_label"], tags.names)
As you can you, while calling the function, you pass the true labels as predicted and predicted as true.
I think the intended usage is as follows:
plot_confusion_matrix(df_tokens["predicted_label"], df_tokens["labels"] tags.names)
Information
I think there is a small mistake in the code while calling the function for
plot_confusion_matrix(y_preds, y_true, labels)
The problem arises in chapter:
Describe the bug
Here is the next line that, I think, contains the mistake, where you call the function:
As you can you, while calling the function, you pass the true labels as predicted and predicted as true.
Expected behavior
I think the intended usage is as follows: