I have the following problem: Let's assume we have a dataset with X and Y values. If we plot them on a scatter plot it would look somehow like the following graph:

scatter plot of dataset

If we have a look at this, we see some patterns here: We have 3 axis. I am looking for an algorithm or ML method to find any description for those axis, for example the linear functions, so that I can obtain the following:

scatter plot with fitted curves

If we would have only a single axis, then I would choose a simple linear regression. But the difficulty here is, that we have these multiple axis.

Do you have an idea how to achieve this?


1 Answer 1


The problem consists of two parts:

  1. partitioning of the data into three clusters, where ech cluster only contains point from a single line

  2. Fitting a line through each cluster

As the curves are straight line in your particular application, the Hough transform is also a good choice, because it solves both problems at once. Here is an online demo with which you can try it out (this demo is for 3D data, but you can simply set the z-component to zero for all points):


For the clustering problem and if one (or more) of the curves are not straight lines, you can try one of the following approaches:

  1. If the points are approximately equidistant: José Lezama, Gregory Randall, Jean-Michel Morel, and Rafael Grompone von Gioi: "An Unsupervised Algorithm for Detecting Good Continuation in Dot Patterns." Image Processing On Line, 7 (2017), pp. 81–92

  2. If the points are not equidistant: Christoph Dalitz, Jens Wilberg, and Lukas Aymans: "TriplClust: An Algorithm for Curve Detection in 3D Point Clouds.", Image Processing On Line, 9 (2019), pp. 26–46

  3. Some fuzzy clustering algorithms might also work.


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