所以我有一些字符串数据,需要对其进行一些操作,然后使用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]。现在,如何找到该标签/存储桶/群集中的其他成员?
干杯!
如果您想找出标签113中的哪些训练数据,则可以这样做
textdata_with_label_113 = textData[clusterer.labels_ == 113]