def plot_conf_matrix(y_actual,y_predict,labels):
cm = confusion_matrix(y_actual,y_predict,labels)
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(cm)
pl.title('confusion matrix')
fig.colorbar(cax)
ax.set_xticklabels([''] + labels)
ax.set_yticklabels([''] + labels)
pl.xlabel('Predicted')
pl.ylabel('True')
pl.show()
评论列表
文章目录