如何设定层次集群的限制

发布于 2025-02-06 00:46:04 字数 795 浏览 2 评论 0原文

我有一个类似的数据集:

C1C2C3C4C5R1
37435R2
42652R3
844462
R494562
R537458 8
R6269110

# 每行的元素确定位置之间的距离。例如,R1和C2之间的距离为7公里。

现在我的问题是:如何设置一个限制,以防止其值大于5?!换句话说,分层算法不包括它们的计算。 请帮助我解决这个问题。 谢谢。

I have a dataset like this :

#c1c2c3c4c5
r137435
r242652
r384462
r494562
r537458
r6269110

and the elements in each row determine the distance between locations. for example distance between r1 and c2 is 7 km.

now my question is: how can I set a limitation that prevents clustering for elements that their values are bigger than 5 ?! in other words, hierarchical algorithm Does not include them in it's calculations.
please help me to solve this problem.
thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江挽川 2025-02-13 00:46:05

使用Sklearn的聚集聚类进行建模,提供5decode> decond_threshold参数如下:

from sklearn.cluster import AgglomerativeClustering
cluster = AgglomerativeClustering(affinity='euclidean', linkage='ward',distance_threshold = 5)  
cluster.fit_predict(data_scaled)

有关更多信息,请检查此博客
[https://www.analyticsvidhya.com/blog/2019/05/beginners-guide-hierarchical-clustering/] [1]

Modelling using sklearn's agglomerative clustering, provide 5 in distance_threshold parameter as follows:

from sklearn.cluster import AgglomerativeClustering
cluster = AgglomerativeClustering(affinity='euclidean', linkage='ward',distance_threshold = 5)  
cluster.fit_predict(data_scaled)

For more information, check this blog
[https://www.analyticsvidhya.com/blog/2019/05/beginners-guide-hierarchical-clustering/][1]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文