0
$\begingroup$

I am using python/numpy to create a histogram as follows:

points_for_histogram = list()
# fill list with data
...

unique_pts = set(points_for_histogram)
hist, bins = np.histogram(points_for_histogram, bins=len(unique_pts))

The generated histogram looks something like this:

enter image description here

So clearly there are these 5 clusters in the histogram. What would be a good way to find the centroid of these clusters? I was thinking to find where the signal drops to zero and try to partition the histogram like that but I think this might not be robust enough.

Is there some other clustering method I could try? I know of K-means but this needs to know the number of clusters a priori.

$\endgroup$
1
  • $\begingroup$ Their weighted centroid (with cluster counts as weights) will coincide with the arithmetic mean of the data. $\endgroup$ – whuber Mar 26 '20 at 10:23