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
评论列表
文章目录