Skip to content

Add clustering binding #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pedramr
Copy link

@pedramr pedramr commented Jun 22, 2025

Running the example:

Clustering 10000 vectors of dimension 64 into 10 clusters

Running simple k-means clustering...
Simple k-means completed in 8.759083ms
Average quantization error: 2698.03

Running clustering with custom parameters...
Sampling a subset of 2560 / 10000 for training
Clustering 2560 points in 64D to 10 clusters, redo 3 times, 25 iterations
  Preprocessing in 0.00 s
Outer iteration 0 / 3
  Iteration 24 (0.01 s, search 0.00 s): objective=2.69803e+07 imbalance=1.296 nsplit=0
Objective improved: keep new clusters
Outer iteration 1 / 3
  Iteration 24 (0.01 s, search 0.01 s): objective=3.06187e+07 imbalance=1.357 nsplit=0
Outer iteration 2 / 3
  Iteration 24 (0.02 s, search 0.01 s): objective=2.0157e+07 imbalance=1.134 nsplit=0
Objective improved: keep new clusters

Advanced clustering completed in 19.593958ms

Comparing clustering quality...
Average distance to nearest centroid:
  Simple k-means:   10705.22
  Advanced method:  8305.35
  Improvement:      22.42% better

Time comparison:
  Simple:   8.759083ms
  Advanced: 19.593958ms (2.2x slower due to multiple runs)

Running the example:
```
Clustering 10000 vectors of dimension 64 into 10 clusters

Running simple k-means clustering...
Simple k-means completed in 8.759083ms
Average quantization error: 2698.03

Running clustering with custom parameters...
Sampling a subset of 2560 / 10000 for training
Clustering 2560 points in 64D to 10 clusters, redo 3 times, 25 iterations
  Preprocessing in 0.00 s
Outer iteration 0 / 3
  Iteration 24 (0.01 s, search 0.00 s): objective=2.69803e+07 imbalance=1.296 nsplit=0
Objective improved: keep new clusters
Outer iteration 1 / 3
  Iteration 24 (0.01 s, search 0.01 s): objective=3.06187e+07 imbalance=1.357 nsplit=0
Outer iteration 2 / 3
  Iteration 24 (0.02 s, search 0.01 s): objective=2.0157e+07 imbalance=1.134 nsplit=0
Objective improved: keep new clusters

Advanced clustering completed in 19.593958ms

Comparing clustering quality...
Average distance to nearest centroid:
  Simple k-means:   10705.22
  Advanced method:  8305.35
  Improvement:      22.42% better

Time comparison:
  Simple:   8.759083ms
  Advanced: 19.593958ms (2.2x slower due to multiple runs)
```
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