This PR fixes a bug that could occasionally happen at the final layer of clustering, where the clusters used to fill the grid would occasionally end up with an unexpectedly large number of state vector elements to assign due to variations in cluster sizes from k-means. This ends up causing the algorithm to assign all excess elements to a single cluster, potentially creating a massive "monster" cluster.
This fix effectively preempts that situation on the last layer of clustering. if the input number of labels to kmeans will exceed the number of clusters yet to be assigned, the algorithm will instead evenly distribute the final elements.
Name and Institution (Required)
Name: Lucas Estrada Institution: Harvard ACMG
Describe the update
This PR fixes a bug that could occasionally happen at the final layer of clustering, where the clusters used to fill the grid would occasionally end up with an unexpectedly large number of state vector elements to assign due to variations in cluster sizes from k-means. This ends up causing the algorithm to assign all excess elements to a single cluster, potentially creating a massive "monster" cluster.
This fix effectively preempts that situation on the last layer of clustering. if the input number of labels to kmeans will exceed the number of clusters yet to be assigned, the algorithm will instead evenly distribute the final elements.