TileDB-Vector-Search icon indicating copy to clipboard operation
TileDB-Vector-Search copied to clipboard

Fix infinite loop in kmeans

Open jparismorgan opened this issue 6 months ago • 0 comments

What

Before this change, if you called kmeans_random_init() with less vectors in training_set than num_partitions_, we would get into an infinite loop. Now we fill centroids in with zeroes instead.

We also add unit tests for this code as it was implicitly tested through other classes, but not explicitly, and not for edge cases like this.

Testing

  • Existing tests pass.
  • New tests pass.

jparismorgan avatar Aug 15 '24 15:08 jparismorgan