Skip to content

Unify integer batch label preparation - #121

Merged
AP6YC merged 1 commit into
developfrom
unify-batch-label-preparation
Sep 30, 2026
Merged

AP6YC merged 1 commit into
developfrom
unify-batch-label-preparation

Conversation

@NiklasMelton

@NiklasMelton NiklasMelton commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • validate, encode, and group integer batch labels with one stable sort
  • preserve first-seen external-label order and within-cluster sample order
  • retain the existing dictionary path for object, float, and string labels
  • reuse the prepared grouping through batch initialization

Performance

Five alternating trials; median trial-average time; complete construction and computation included; OPENBLAS_NUM_THREADS=1. Streaming is included as a control and remains within approximately 1%.

10,000 samples, 2 features, 10 clusters

CVI Batch parent → PR Speedup Stream parent → PR
CH 3.154 → 0.523 ms 6.04x 157.951 → 159.931 ms
WB 3.175 → 0.509 ms 6.24x 159.212 → 158.737 ms
DB 3.306 → 0.566 ms 5.84x 282.379 → 281.886 ms
XB 3.245 → 0.545 ms 5.95x 175.204 → 176.308 ms
GD43 3.311 → 0.547 ms 6.06x 157.152 → 157.664 ms
GD53 3.184 → 0.528 ms 6.03x 142.292 → 142.319 ms
PS 3.199 → 0.512 ms 6.25x 465.374 → 463.634 ms
cSIL 3.538 → 0.820 ms 4.31x 570.177 → 575.377 ms
rCIP 8.271 → 6.702 ms 1.23x 798.029 → 797.355 ms

4,096 samples, 8 features, 128 clusters

CVI Batch parent → PR Speedup Stream parent → PR
CH 2.174 → 1.060 ms 2.05x 621.106 → 621.727 ms
WB 2.161 → 1.066 ms 2.03x 622.514 → 623.460 ms
DB 3.853 → 2.740 ms 1.41x 4774.175 → 4769.840 ms
XB 2.635 → 1.534 ms 1.72x 246.804 → 246.778 ms
GD43 2.633 → 1.533 ms 1.72x 147.606 → 147.545 ms
GD53 3.575 → 2.494 ms 1.43x 174.268 → 174.284 ms
PS 2.714 → 1.627 ms 1.67x 1908.379 → 1908.744 ms
cSIL 4.569 → 3.465 ms 1.32x 2623.028 → 2606.321 ms
rCIP 96.631 → 95.888 ms 1.01x 4258.136 → 4265.017 ms

scikit-learn reference

Workload CVI PR time scikit-learn time Relative performance
10k / 2D / 10 clusters, CH 0.523 ms 0.592 ms CVI 1.13x faster
10k / 2D / 10 clusters, DB 0.566 ms 1.033 ms CVI 1.83x faster
4096 / 8D / 128 clusters, CH 1.060 ms 2.165 ms CVI 2.04x faster
4096 / 8D / 128 clusters, DB 2.740 ms 7.520 ms CVI 2.74x faster

CH is equivalent. DB is a related timing reference: this package uses squared distances while scikit-learn uses Euclidean distances.

Validation

  • 805 passed, 140 optional-JAX skips
  • signed, unsigned, Boolean, object, float, and string label-order tests pass on NumPy and Numba

Issue

Closes #130

@AP6YC
AP6YC force-pushed the unify-batch-label-preparation branch from 768dc5c to 0b7471c Compare September 30, 2026 02:15
@NiklasMelton
NiklasMelton marked this pull request as ready for review September 30, 2026 05:48
@NiklasMelton
NiklasMelton requested a review from AP6YC September 30, 2026 05:48
@AP6YC
AP6YC merged commit 415c903 into develop Sep 30, 2026
7 checks passed
@AP6YC
AP6YC deleted the unify-batch-label-preparation branch September 30, 2026 15:12
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.

Unify integer batch label preparation

2 participants