Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: httphttps://stackoverflow.com/q/41634047/868905; https://stats.stackexchange.com/q/152333/3277; https://stats.stackexchange.com/q/125655/3277; https://stats.stackexchange.com/q/13744/3277; httphttps://stackoverflow.com/q/24919346/868905; httphttps://stackoverflow.com/q/18009664/868905; httphttps://stackoverflow.com/q/29243800/868905; httphttps://stackoverflow.com/q/11075272/868905; ]

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: http://stackoverflow.com/q/41634047/868905; https://stats.stackexchange.com/q/152333/3277; https://stats.stackexchange.com/q/125655/3277; https://stats.stackexchange.com/q/13744/3277; http://stackoverflow.com/q/24919346/868905; http://stackoverflow.com/q/18009664/868905; http://stackoverflow.com/q/29243800/868905; http://stackoverflow.com/q/11075272/868905; ]

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: https://stackoverflow.com/q/41634047/868905; https://stats.stackexchange.com/q/152333/3277; https://stats.stackexchange.com/q/125655/3277; https://stats.stackexchange.com/q/13744/3277; https://stackoverflow.com/q/24919346/868905; https://stackoverflow.com/q/18009664/868905; https://stackoverflow.com/q/29243800/868905; https://stackoverflow.com/q/11075272/868905; ]

replaced http://stats.stackexchange.com/ with https://stats.stackexchange.com/
Source Link

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: http://stackoverflow.com/q/41634047/868905; httphttps://stats.stackexchange.com/q/152333/3277; httphttps://stats.stackexchange.com/q/125655/3277; httphttps://stats.stackexchange.com/q/13744/3277; http://stackoverflow.com/q/24919346/868905; http://stackoverflow.com/q/18009664/868905; http://stackoverflow.com/q/29243800/868905; http://stackoverflow.com/q/11075272/868905; ]

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: http://stackoverflow.com/q/41634047/868905; http://stats.stackexchange.com/q/152333/3277; http://stats.stackexchange.com/q/125655/3277; http://stats.stackexchange.com/q/13744/3277; http://stackoverflow.com/q/24919346/868905; http://stackoverflow.com/q/18009664/868905; http://stackoverflow.com/q/29243800/868905; http://stackoverflow.com/q/11075272/868905; ]

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: http://stackoverflow.com/q/41634047/868905; https://stats.stackexchange.com/q/152333/3277; https://stats.stackexchange.com/q/125655/3277; https://stats.stackexchange.com/q/13744/3277; http://stackoverflow.com/q/24919346/868905; http://stackoverflow.com/q/18009664/868905; http://stackoverflow.com/q/29243800/868905; http://stackoverflow.com/q/11075272/868905; ]

added 181 characters in body
Source Link
ttnphns
  • 58.8k
  • 53
  • 287
  • 512

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: http://stackoverflow.com/q/41634047/868905; http://stats.stackexchange.com/q/152333/3277; http://stats.stackexchange.com/q/125655/3277; http://stats.stackexchange.com/q/13744/32773277; http://stackoverflow.com/q/24919346/868905; http://stackoverflow.com/q/18009664/868905; http://stackoverflow.com/q/29243800/868905; http://stackoverflow.com/q/11075272/868905; ]

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added by @ttnphns: http://stackoverflow.com/q/41634047/868905; http://stats.stackexchange.com/q/152333/3277; http://stats.stackexchange.com/q/125655/3277; http://stats.stackexchange.com/q/13744/3277 ]

I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).

What should I do? Shall I delete it or just stop updating its value? Why?

I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.

In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).

Each colour represent a cluster in the current iteration and each X represent its centroid (each centroid is marked with the number of the iteration in which it has been computed)


[Some related links about empty cluster case, added later by @ttnphns: http://stackoverflow.com/q/41634047/868905; http://stats.stackexchange.com/q/152333/3277; http://stats.stackexchange.com/q/125655/3277; http://stats.stackexchange.com/q/13744/3277; http://stackoverflow.com/q/24919346/868905; http://stackoverflow.com/q/18009664/868905; http://stackoverflow.com/q/29243800/868905; http://stackoverflow.com/q/11075272/868905; ]

added 279 characters in body
Source Link
ttnphns
  • 58.8k
  • 53
  • 287
  • 512
Loading
added comment about motivation for question
Source Link
gung - Reinstate Monica
  • 147.5k
  • 89
  • 406
  • 717
Loading
added 153 characters in body
Source Link
Maurizio
  • 143
  • 1
  • 6
Loading
added 153 characters in body
Source Link
Maurizio
  • 143
  • 1
  • 6
Loading
Rollback to Revision 1
Source Link
Maurizio
  • 143
  • 1
  • 6
Loading
added 4 characters in body
Source Link
Maurizio
  • 143
  • 1
  • 6
Loading
added 39 characters in body
Source Link
Maurizio
  • 143
  • 1
  • 6
Loading
Source Link
Maurizio
  • 143
  • 1
  • 6
Loading