Body: <p>I'm looking for a machine learning algorithm for clustering points based on their coordinates. Furthermore, I want to take into consideration the weights of each point. Suppose there is a weight in each point. Then we take the sum of the weight of all the points in a cluster. I want the sum in different clusters to be close and balanced. What algorithm is best for this? Any suggestion?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-16T07:25:45.090Z
Comments.Text: Maybe try to use weights as 'z' coordinate and perform k-means clustering. I don't know if that's the best approach though.
Comments.UserDisplayName: MASTER OF CODE
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-17T02:04:51.063Z
Comments.Text: if z is weight, then all the points with greater weight will be packed together isn't it? Then the sum of them will be the biggest? Am I right?
Comments.UserDisplayName: chung sze wong
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-17T09:34:48.620Z
Comments.Text: Oh, I misunderstood Your question. You just have (x, y) coordinates and want to perform basic clustering? Just google clustering algorithms like k-means, DBSCAN, BIRCH or mean-shift. You don't need to add any weight to Your data.
Comments.UserDisplayName: MASTER OF CODE
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-20T03:07:59.410Z
Comments.Text: ok, this solves my first problem. But what if each point has a weight. So how I make the total weight in a cluster is similar to others? Using kmeans,.... will only consider their locations and cluster them together and not considering the weight of the points.
Comments.UserDisplayName: chung sze wong
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-20T04:26:22.110Z
Comments.Text: just assume the weight as a third parameter. However, I cannot simply put it as 'z' coordinates and do clustering. Because this will pack those 'heavier' points together and making clusters not balanced
Comments.UserDisplayName: chung sze wong
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-20T07:15:16.447Z
Comments.Text: Okay, from the beginning. You have (x, y) points and want to cluster them. You've done this by k-means and that's great. Now You want to add weight as an 3rd parameter. If You want to perform clustering on that points, but not taking weights as an 'z' coordinate pls provide more information what this 'weight' means to You. Maybe some more specific information about dataset and problem itself, because there could be some better solution than simple clustering.
Comments.UserDisplayName: MASTER OF CODE
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-20T08:11:45.030Z
Comments.Text: ok, let say each point is a cell station and has traffic (this is my 'z'). (x,y) is the latitude and longitude. So with pure k mean I can cluster the stations that are close to each other. But some clusters may have very large total traffics compared to others. (if the heavy traffic stations are closely packed.) Is it possible i can make the clusters balanced by minimizing the difference of the total traffics between clusters.
Comments.UserDisplayName: chung sze wong
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-20T08:21:41.620Z
Comments.Text: Okay, and how about looping over possible k for k-means and calculate the mean of the clusters in respect to weights. After that You could calculate std dev of collected means. Choose number of clusters with the smaller std dev. That might be not computationally efficient, but You could find good solution in this way.
Comments.UserDisplayName: MASTER OF CODE
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-20T08:33:14.350Z
Comments.Text: this idea is pretty inspiring, thanks for your help.
Comments.UserDisplayName: chung sze wong
Tags: <machine-learning><python><algorithm-request><clustering><scikit-learn>
Title: What is the best machine learning algorithm for clustering dots based on coordinates $(x,y)$ with consideration of weight of the points?
UserDisplayName: chung sze wong
ThreadText: # What is the best machine learning algorithm for clustering dots based on coordinates $(x,y)$ with consideration of weight of the points?
  
  (Asked by: username_0 on 2021-12-16)
  
  I'm looking for a machine learning algorithm for clustering points based on their coordinates. Furthermore, I want to take into consideration the weights of each point. Suppose there is a weight in each point. Then we take the sum of the weight of all the points in a cluster. I want the sum in different clusters to be close and balanced. What algorithm is best for this? Any suggestion?
  
  **Tags:** machine-learning, python, algorithm-request, clustering, scikit-learn
  
  > **Comments:**
  > **username_1**: Maybe try to use weights as 'z' coordinate and perform k-means clustering. I don't know if that's the best approach though.  
  > **username_0**: if z is weight, then all the points with greater weight will be packed together isn't it? Then the sum of them will be the biggest? Am I right?  
  > **username_1**: Oh, I misunderstood Your question. You just have (x, y) coordinates and want to perform basic clustering? Just google clustering algorithms like k-means, DBSCAN, BIRCH or mean-shift. You don't need to add any weight to Your data.  
  > **username_0**: ok, this solves my first problem. But what if each point has a weight. So how I make the total weight in a cluster is similar to others? Using kmeans,.... will only consider their locations and cluster them together and not considering the weight of the points.  
  > **username_0**: just assume the weight as a third parameter. However, I cannot simply put it as 'z' coordinates and do clustering. Because this will pack those 'heavier' points together and making clusters not balanced  
  > **username_1**: Okay, from the beginning. You have (x, y) points and want to cluster them. You've done this by k-means and that's great. Now You want to add weight as an 3rd parameter. If You want to perform clustering on that points, but not taking weights as an 'z' coordinate pls provide more information what this 'weight' means to You. Maybe some more specific information about dataset and problem itself, because there could be some better solution than simple clustering.  
  > **username_0**: ok, let say each point is a cell station and has traffic (this is my 'z'). (x,y) is the latitude and longitude. So with pure k mean I can cluster the stations that are close to each other. But some clusters may have very large total traffics compared to others. (if the heavy traffic stations are closely packed.) Is it possible i can make the clusters balanced by minimizing the difference of the total traffics between clusters.  
  > **username_1**: Okay, and how about looping over possible k for k-means and calculate the mean of the clusters in respect to weights. After that You could calculate std dev of collected means. Choose number of clusters with the smaller std dev. That might be not computationally efficient, but You could find good solution in this way.  
  > **username_0**: this idea is pretty inspiring, thanks for your help.  
  
  ---
  
  ## 0 answers
  
  