def plot_fitted_data(points, c_means, c_variances):
"""Plots the data and given Gaussian components"""
plt.plot(points[:, 0], points[:, 1], "b.", zorder=0)
plt.plot(c_means[:, 0], c_means[:, 1], "r.", zorder=1)
for i in range(c_means.shape[0]):
std = np.sqrt(c_variances[i])
plt.axes().add_artist(pat.Ellipse(
c_means[i], 2 * std[0], 2 * std[1],
fill=False, color="red", linewidth=2, zorder=1
))
plt.show()
# PREPARING DATA
# generating DATA_POINTS points from a GMM with COMPONENTS components
评论列表
文章目录