[英]DBSCAN python with periodic boundary conditions
I'm trying to use sklearn.cluster.DBSCAN sklearn.cluster.DBSCAN for analysis of clusters in a 2D grid. 我正在尝试使用sklearn.cluster.DBSCAN sklearn.cluster.DBSCAN来分析2D网格中的群集。 http://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN But I have encountered the problem, that clustering across periodic boundary conditions is not implemented. http://scikit-learn.org/stable/modules/generation/sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN但是我遇到了这个问题,即无法实现跨周期性边界条件的聚类。
Does anyone know an implementation that takes periodic boundary conditions into account? 有谁知道考虑周期性边界条件的实现? or how to implement it? 或如何实施?
/ Mikkel C / Mikkel C
DBSCAN does not need to be modified for this. 无需为此修改DBSCAN。
Just roll your own distance function, instead of using Euclidean distance. 只需滚动您自己的距离函数,而不使用欧几里得距离即可。
There you can easily implement your periodic boundary conditions. 在那里,您可以轻松实现您的周期性边界条件。
You can add an extra dimension to enforce periodic boundary conditions. 您可以添加额外的维度以强制执行周期性边界条件。 Say I wanted to use DBSCAN to extract points by their angle (theta) in polar coordinates. 假设我想使用DBSCAN通过极坐标中的角度(θ)提取点。 If I run DBSCAN on [theta], points 1 degree and 359 degrees would not be clustered together. 如果我在θ上运行DBSCAN,则1度和359度的点将不会聚在一起。 However if I run DBSCAN on [sin(theta), cos(theta)], this solves the issue. 但是,如果我在[sinθ,cosθ]上运行DBSCAN,则可以解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.