demo.py 文件源码

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

项目:plda 作者: RaviSoji 项目源码 文件源码
def plot_scatter(ax, x, y, s=5, c='black', label='', plot_training_cov=False,
                 model=None):
    assert len(x.shape) == 1
    assert len(y.shape) == 1
    if plot_training_cov is True:
        assert model is not None

    ax.scatter(x, y, c=c, s=s, label=label)

    if plot_training_cov is True:
        cov = model.data[label]['cov']
        mean_x, mean_y = model.data[label]['mean']
        w, h, deg = cov_ellipse(cov, nsig=2)
        ell = Ellipse(xy=(mean_x, mean_y),
                      width=w, height=h,
                      angle=deg, linewidth=2)
        ell.set_facecolor('none')
        ell.set_edgecolor('black')
        ax.add_patch(ell)
    ax.set_aspect('equal')

    return ax
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号