Skip to content

Fix Kmeans cluster updates issue#13

Open
CanYing0913 wants to merge 1 commit intojokofa:masterfrom
CanYing0913:master
Open

Fix Kmeans cluster updates issue#13
CanYing0913 wants to merge 1 commit intojokofa:masterfrom
CanYing0913:master

Conversation

@CanYing0913
Copy link

As this stackoverflow answer suggested, current groupd_by_label_mean function cannot work with clusters with zero data point assigned to them, causing possibly entire rows of M being 0, which will lead to NaN values when calling F.normalize() and propagate to all centers.
Fixed by creating masks for those empty clusters. Current solution will maintain those centers as the centers before current iteration. We can also set them to 0s if that's more aligned mathematically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant