def plot_classes(y, cord, names, test_error, message=""):
plt.close("all")
cord = np.array(cord)
colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k')
un = np.unique(y)
fig, ax = plt.subplots()
for u, col in zip(un, colors):
ind = np.argwhere(y == u)
x = cord[ind, :]
x = x.reshape(x.shape[0], cord.shape[1])
ax.scatter(x[:, 0], x[:, 1], label="class:" + str(u),
color=col)
plt.legend(loc='upper right', fancybox=True, shadow=True, prop={'size': 8})
fig.suptitle(
"Output prediction. Test error:" + str(test_error*100) + "%. " +
message, fontsize=8)
return fig
tools.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录