使用HDBSCAN检索群集的成员

问题描述 投票:0回答:1

所以我有一些字符串数据,需要对其进行一些操作,然后使用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))

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

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

甜,看起来好像在预测新的情况,因此它认为新的字符串值对应于标签[113]。现在,如何找到该标签/存储桶/群集中的其他成员?

干杯!

python machine-learning cluster-analysis k-means hdbscan
1个回答
0
投票

如果您想找出标签113中的哪些训练数据,则可以这样做

textdata_with_label_113 = textData[clusterer.labels_ == 113]
© www.soinside.com 2019 - 2024. All rights reserved.