Skip to content

Optimize batch and incremental CVI performance #128

Closed
7 of 7 issues completed
Closed

Description

@NiklasMelton

Goal

Measure and reduce the total time required to compute the batch and incremental CVIs while preserving their shared implementation structure and numerical definitions. CONN is measured by the benchmark but excluded from this optimization effort.

Benchmark

  • ten balanced, well-separated 2D Gaussian clusters
  • dataset prefixes from 100 through 10,000 samples
  • five complete calculations per index, method, and sample count on fresh objects
  • total elapsed time for a complete batch calculation or for streaming the entire prefix
  • geometric means with two-sided 95% Student-t intervals on log timings
  • scikit-learn reference implementations for Calinski-Harabasz and Davies-Bouldin

Baseline at 10,000 samples

Measured before the optimization stack with OPENBLAS_NUM_THREADS=1:

CVI Batch Incremental
CH 3.154 ms 157.951 ms
WB 3.175 ms 159.212 ms
DB 3.306 ms 282.379 ms
XB 3.245 ms 175.204 ms
GD43 3.311 ms 157.152 ms
GD53 3.184 ms 142.292 ms
PS 3.199 ms 465.374 ms
cSIL 3.538 ms 570.177 ms
rCIP 8.271 ms 798.029 ms

Baseline scikit-learn comparison

Workload CVI baseline scikit-learn Baseline relationship
10k / 2D / 10 clusters, CH 3.154 ms 0.592 ms scikit-learn 5.33x faster
10k / 2D / 10 clusters, DB 3.306 ms 1.033 ms scikit-learn 3.20x faster
4096 / 8D / 128 clusters, CH 2.174 ms 2.165 ms approximately equal
4096 / 8D / 128 clusters, DB 3.853 ms 7.520 ms CVI 1.95x faster

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

Completed result represented by the PR stack

  • shared batch label preparation and distance kernels are reused across indices
  • CH, WB, DB, XB, GD43, GD53, PS, cSIL, and rCIP receive targeted improvements
  • batch and incremental code paths retain shared evaluators rather than diverging implementations
  • the final 10,000-sample benchmark measures CH at 0.587 ms versus scikit-learn at 0.601 ms, and DB at 0.655 ms versus scikit-learn at 1.219 ms
  • regression coverage verifies numerical definitions and batch-to-incremental state transitions
  • the benchmark script and final 12-panel figure are committed; raw run records remain outside repository history

Completion

This issue is complete when all seven sub-issues and the native stacked PR are merged. The top PR carries an explicit closing reference to this tracker and every sub-issue.

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions