0
votes

I'm trying to use sklearn.cluster.DBSCAN sklearn.cluster.DBSCAN for analysis of clusters in a 2D grid. 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.

Does anyone know an implementation that takes periodic boundary conditions into account? or how to implement it?

/ Mikkel C

2

2 Answers

1
votes

DBSCAN does not need to be modified for this.

Just roll your own distance function, instead of using Euclidean distance.

There you can easily implement your periodic boundary conditions.

0
votes

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. If I run DBSCAN on [theta], points 1 degree and 359 degrees would not be clustered together. However if I run DBSCAN on [sin(theta), cos(theta)], this solves the issue.