【问题标题】:Retrieving members of a cluster with HDBSCAN使用 HDBSCAN 检索集群的成员
【发布时间】:2019-11-19 16:20:13
【问题描述】:

所以我有一些字符串数据,我对其进行了一些操作,然后使用 HDBSCAN 创建了一个集群:

textData = train['eudexHash'].apply(lambda x: str(x))
clusterer = hdbscan.HDBSCAN(min_cluster_size=5,
                            gen_min_span_tree=True,
                            prediction_data=True).fit(textData.values.reshape(-1,1))

现在,当我调用集群以使用approximate_predict 进行预测时,我得到以下结果:

>>>> hdbscan.approximate_predict(clusterer, testCase)
(array([113]), array([1.]))

Sweet,看起来它在预测新的案例,所以它认为新的字符串值对应于标签 [113]。现在,我如何找到该标签/存储桶/集群中的其他成员?

干杯!

【问题讨论】:

    标签: python machine-learning cluster-analysis k-means hdbscan


    【解决方案1】:

    如果您想找出哪些训练数据属于标签 113,那么您可以这样做

    textdata_with_label_113 = textData[clusterer.labels_ == 113]
    

    【讨论】:

    • 嘿,非常感谢,我没想到索引会像'=='。真的,我期待在 clusterer.labels_.something 之后再次调用以将所有成员置于标签下!谢谢老兄!
    猜你喜欢
    • 1970-01-01
    • 2021-02-27
    • 2012-04-07
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    • 2020-10-23
    • 1970-01-01
    • 2013-12-13
    相关资源
    最近更新 更多