Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用HDBSCAN检索群集成员_Python_Machine Learning_Cluster Analysis_K Means_Hdbscan - Fatal编程技术网

Python 使用HDBSCAN检索群集成员

Python 使用HDBSCAN检索群集成员,python,machine-learning,cluster-analysis,k-means,hdbscan,Python,Machine Learning,Cluster Analysis,K Means,Hdbscan,所以我有一些字符串数据,我对其进行了一些操作,然后使用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

所以我有一些字符串数据,我对其进行了一些操作,然后使用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.]))
Sweet,看起来它在预测新的情况,所以它认为新的字符串值对应于标签[113]。现在,我如何找到该标签/存储桶/集群中的其他成员


干杯

如果您想知道哪个训练数据是标签113的一部分,那么您可以这样做

textdata_with_label_113 = textData[clusterer.labels_ == 113]

嘿,非常感谢,我没想到索引会像“==”一样。真的,我在等clusterer.labels.之后的另一个电话,让所有成员都有一个标签!谢谢你,巴德!