tools.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:learning-class-invariant-features 作者: sbelharbi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号