def ex2_kmeans(X, y):
""" Applies the KMeans algorithm on X, y using K=10 and print the
silhouette score of this model. X and y are returned by transform_text
above.
"""
model = KMeans(10).fit(X, y)
print "Silhouette score: %f" % metrics.silhouette_score(X, model.labels_)
# Ex 3
评论列表
文章目录