Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A package for running k-means on a Condor cluster

Project Description

A Condor-powered K-means implementation
<p align="center">
<img src="" alt="Example K-means Solution"/>

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 History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(13.6 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Oct 14, 2016
(10.8 kB) Copy SHA256 Hash SHA256
Source None Oct 14, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers