News for hackers. Stuff that matters.
Re:Introduction to K-Means Clustering by CardenB on Monday March 14, 2022 @01:13PM (#30675073)
What prevents you from using a different distance than Euclidean distance?
Re:Introduction to K-Means Clustering by amilios on Monday March 14, 2022 @01:40PM (#30675439)
The way k-means is constructed is not based on distances.

K-means minimizes within-cluster variance. If you look at the definition of variance, it is identical to the sum of squared Euclidean distances from the centroid

Re:Introduction to K-Means Clustering by nerdponx on Monday March 14, 2022 @01:55PM (#30675645)
Do you lose convergence guarantees if you minimize "sum of squared distances from the centroid" using your other-than-Euclidean distance metric?
Re:Introduction to K-Means Clustering by danuker on Monday March 14, 2022 @01:32PM (#30675337)
Suppose you use prices and square meters, to cluster apartments. Suppose you also use a simple metric, like:

  distance <- sqrt(d_price*2 + d_area*2)
Without normalizing the units somehow, so that they have a meaningfully similar numeric expression, you are essentially only clustering by price, which is in the tens- or hundreds-of-thousands.

You use very little information about the area, because that is in the hundreds, at most thousands.

Re:Introduction to K-Means Clustering by nerdponx on Monday March 14, 2022 @02:14PM (#30675913)
This has nothing to do with using non-Euclidean distance, though. This is a separate issue related to having features on different scales.
Re:Introduction to K-Means Clustering by danuker on Tuesday March 15, 2022 @06:34AM (#30683689)
It was an example metric with coefficients of 1 for each feature.

The point I was making was that the different scale of the features influences the result by a lot.

Re:Introduction to K-Means Clustering by jacquesm on Monday March 14, 2022 @01:38PM (#30675407)
That is not a proper distance function.
Re:Introduction to K-Means Clustering by danuker on Monday March 14, 2022 @02:08PM (#30675825)
What do you mean? Is it not the Euclidean distance?

https://en.wikipedia.org/wiki/Euclidean_distance