medium_posts
medium_posts copied to clipboard
inquiries on data_weighted_kmeans and a dataframe version
I just took a look at your post which was fantastic, as I wanted exactly what you did. In reviewing the code, I had some inquiries.
Is L83 ever used?
# number of dimensions
d = len(points[0]['coords'])
I was curious on the use of squared difference for one distance calculation (L93) and distance()
for another (L126. Why not use the same for both?
In addition, I hoped to use my existing data frame and wrote a revised implementation that allows one to pass a data frame, specifying the column names to use for x, y, and weight. You can take a look at that at this gist if you're interested.