[英]Is there a way to draw confusion matrix with known True Positive, True Negative, False Positive and False Negative?
Today I have finished processing some data and came to conclusion that I have the following final tables containing:今天我已经完成了一些数据的处理并得出结论,我有以下最终表格,其中包含:
Counts.计数。 | |
---|---|
True Positive真阳性 | 23070 23070 |
True Negative真阴性 | 4503 4503 |
False Positive假阳性 | 28 28 |
False Negative假阴性 | 34 34 |
I am trying to construct a confusion matrix here, scikit-learn.confusion_matrix style, but I cant figure out how.我正在尝试在这里构建一个混淆矩阵,scikit-learn.confusion_matrix 样式,但我不知道如何。 Can I use Matplotlib for this instead?我可以为此使用 Matplotlib 吗? Do you guys ever come to his type of quest?你们有没有来过他的任务类型? I believe we can draw it somehow.我相信我们可以以某种方式绘制它。 Thank you!谢谢!
With scikit-learn.confusion_matrix
You can get the confusion matrix by用scikit-learn.confusion_matrix
你可以得到混淆矩阵cm = confusion_matrix(y_true, y_pred)
And the confusion matrix is already in the form并且混淆矩阵已经是形式TP|FN
FP|TN
You can use seaborn's heatmap to plot the data:您可以使用 seaborn 的热图到 plot 数据:
import seaborn as sns
sns.heatmap(cm, annot=True, cmap='Blues')
If you already have the data then try storing it in a list of list then plot the data using seaborn:如果您已经拥有数据,请尝试将其存储在列表列表中,然后使用 seaborn 将数据存储在 plot 中:
cm_data = [[23070, 34], [4503, 28]]
sns.heatmap(cm_data, annot=True, cmap='Blues', fmt='d')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.