Home

Awesome

ZENTAS

A C++ and (optional) Python tool for partitional clustering. Optimised implementations of K-Medoids and K-Means, for various data types. More information is in our paper at arXiv 1609.04723.

K-Medoids a.k.a. K-Centers

Given N elements x(1)...x(N), select K elements indexed by c(1)...c(K), to minimise sum(i=1...N) min(k=1...K) E(distance (x(i), x(c(k)))) where distance is a valid distance and E is a non-decreasing function with E(0) = 0.

distance options are

Energy E options are

K-Means for dense and sparse vector data

PREREQUISITES

CONFIGURE WITH CMAKE

Create a build directory:

mkdir build; cd build;

If you do NOT want the Python library,

cmake -DBUILD_PYTHON_LIB=NO ..

If you do want the Python library,

cmake ..

BUILD

The library can be built, from the build directory

make -j5

The shared library should now be in ./build/zentas (libzentas.so in Linux) and the Python shared library in ./build/python (pyzentas.so in Linux). These can be moved/copied elsewhere manually, there is currently no install option for zentas.

USING

Example use cases of the C++ library and headers are in testsexamples, with the corresponding executables in build/testsexamples. There is an example of clustering dense vectors (exdense.cpp), sparse vectors (exsparse.cpp), and sequences (exwords.cpp).

To use the Python library, make sure pyzentas.so is on PYTHONPATH, for example you can use sys.path.append(/path/to/pyzentas.so). Examples using pyzentas are in python/examples.py. More information can be obtained from the doc strings, try

import pyzentas
help(pyzentas)

Doesn't work, or missing a feature?

Please raise an issue in the zentas repository