I'm looking for a clustering algorithm that will make cluster depending on a orientation. The DBSCAN algorithm cluster points based on a constant radius :


Is there a implementation of DBSCAN that is based on "ellipse instead of circle" ?


Ok so my solution was to work on my data set. I had a set of 2D points and I wanted to favor the definition of clusters depending of a given orientation.

My solution was to center my set of point on the origin of the coordinate system, rotate them by the orientation you want and apply this vector field on the set of point : X(x, y) = (x-x*a, y) , where a is the factor that determine if the orientation should matter a lot or not (a ∈ [0, 1]) .

Then apply the DBSCAN of this modified dataset.

I hope I was clear enough, don't hesitate to ask me if it's not the case.


1 Answer 1


If I remember correctly, non-negative matrix factorization (NMF) can be used as a clustering approach that can recover clusters that are along vectors, for example. It may work for your dataset. It factors a data matrix $D \in \mathbb{R}^{m * n}$ into two matrices $W \in \mathbb{R}^{m*k}$ and $H \in \mathbb{R}^{k * n}$. Effectively, $W$ contains the weights that are applied to each vector in $H$ to reconstruct the original data; one way of using this method is to interpret the $n$-dimensional vectors in $H$ as clusters (these vectors would be the 'directions' that your data is along) and the $k$-dimensional vectors in $W$ as the data-example-wise affinities for the different clusters. One method to cluster with this process is to simply place each of the $m$ data examples into the cluster with the index of the highest value in the $W$ vector.

There are implementations in several standard libraries, including sklearn, so it should be relatively easy to try it out. Good luck, and welcome to the site!

  • $\begingroup$ Thank you so much for your answer ! I will check it out and update my finding. Another possibility that I'm exploring is to use a custom metric for the DBSCAN. $\endgroup$
    – koumoul
    Nov 21, 2018 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.