Skip to main content
A Condor-powered K-means implementation
---------------------------------------
<p align="center">
<img src="https://github.com/tansey/condor-kmeans/blob/master/test/results.png?raw=true" alt="Example K-means Solution"/>
</p>


This package lets you run K-means on a really big dataset of vectors. You can even stream the vectors instead of loading them into memory, so long as you can store two lists of doubles the size of your vector count (one list for cluster assignment IDs and one for distance from each vector to its cluster).

## Installation

Installation is available via `pip`:

```
pip install condor-kmeans
```

## Usage

The package assumes you have a CSV file of vectors which you wish to cluster, with one vector per row. Once installed, you can simply run the `kmeans` command:

```
kmeans path/to/mydata.csv path/to/save/centroids.csv path/to/save/assignments.csv --num_clusters 30 --plusplus --stream --condor --condor_workers 100 --condor_username myusername
```

The above command will run k-means on the vectors stored in `mydata.csv` on condor with no more than 100 jobs at a time. It will save the resulting cluster centroids to `centroids.csv`, and the resulting vector-to-cluster assignments to `assignments.csv`. The `--plusplus` command specifies it should use k++ initialization. `--stream` says to stream `mydata.csv` from disk instead of loading it all into memory.

The current directory is used as the working directory. A working subdirectory named `condor` will be created. All temporary worker files are deleted after each batch of jobs is finished successfully, though the directory structure is maintained (feel free to just `rm -rf condor` afterward if you wish). If one of the workers fails, the master will throw an exception and alert you to the job that failed and where to find its output files; the temporary files will not be deleted if a worker fails.

Release files for condor-kmeans 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for condor-kmeans 0.9
File Size Uploaded
condor-kmeans-0.9.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for condor-kmeans 0.9
File Interpreter ABI Platform
condor_kmeans-0.9-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size:24.4 kB

Release files / condor-kmeans-0.9.tar.gz

Download URL condor-kmeans-0.9.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf18704528ebea016bc544b832409cb5942f30906786e4043eeb1c06a9a0458d
BLAKE2b-256 checksum
How to use checksums
9405723b443921a15055c305c94916f35f73ddc4e455ba888585f5363c60dd76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / condor_kmeans-0.9-py2.py3-none-any.whl

Download URL condor_kmeans-0.9-py2.py3-none-any.whl
Size 13.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
34559e6c71a9dd62d4ac7f9c5b3bd6843a858e3bf4beed86e7eba5a8a064006d
BLAKE2b-256 checksum
How to use checksums
4fa776fcfc342b07a18379b66e861a1351b696ab3dac56182c4e23eb4911e6a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.9 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page