tp3_solutions.py 文件源码

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

项目:TPs 作者: DataMiningP7 项目源码 文件源码
def evaluate_kmeans(X, model):
    """ Evaluate a K-Means model that has been trained on X using the
     Silhouette score.

    Args:
        X: the TF-IDF matrix where each line represents a document and each
           column represents a word, typically obtained by running
           transform_text() from the TP2.
        model: the KMeans model trained on X.
    Returns:
        A double that corresponds to the Silhouette score of the model.
    """
    return silhouette_score(X, model.labels_)


# Ex2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号