I have a list of 1D values, like this:
x = [20 21 30 31 200 201]
These values have corresponding weights:
w = [100 100 100 100 1 1]
I know that there are $k = 2$ clusters in this dataset. Using regular k-means results in
centroids = [25.5, 200.5]
But I want to take the weights into account, making the values near 200 basically meaningless.
So I want the two cluster centroids to be more like:
centroids = [20.5, 30.5]
I feel that the right clustering algorithm is something like mean shift, which finds that $20.5$ and $30.5$ are the two prominent peaks in the data. But I want it to find exactly 2 clusters, so regular mean shift won't work. Is there a good algorithm that can achieve this?