问NameError:未定义名称“plot_confusion_matrix”ENusing 声明和using 编译指令 using 声明将特定的名称...
如果你需要绘制混淆矩阵,除了使用 scikit-learn 提供的 plot_confusion_matrix 函数外,你也可以手动计算混淆矩阵并使用 matplotlib 等库进行绘制。但直接使用 scikit-learn 提供的函数会更加方便和直观。 如果你在使用其他机器学习库或框架,也可以查看它们是否提供了类似的绘图功能。例如,TensorFlow 和 PyTorch 等框架也提...
After importing the necessary packages, we need to create the confusion matrix from the given data. First, we declare the variablesy_trueandy_pred.y-trueis filled with the actual values whiley-predis filled with the predicted values. y_true=["bat","ball","ball","bat","bat","bat"]y_...
cm = confusion_matrix(y_true1, y_pre) plt.matshow(cm) plt.title(u'混淆矩阵',fontproperties=custom_font) plt.colorbar() plt.ylabel(u'实际类型',fontproperties=custom_font) plt.xlabel(u'预测类型',fontproperties=custom_font) plt.show() 每天进步一点点 分类: python 好文要顶 关注我 收藏...