https://github.com/idiap/zentas
Partitional data clustering around centers
https://github.com/idiap/zentas
Last synced: about 1 year ago
JSON representation
Partitional data clustering around centers
- Host: GitHub
- URL: https://github.com/idiap/zentas
- Owner: idiap
- License: gpl-3.0
- Created: 2016-09-15T10:45:00.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T05:40:22.000Z (almost 7 years ago)
- Last Synced: 2025-03-23T01:02:34.714Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 598 KB
- Stars: 8
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# 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](https://arxiv.org/abs/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
* for sparse and dense vectors : l-0, l-1, l-2, l-infinity
* for sequence data : Levenshtein and Normalised Levenshtein.
Energy *E* options are
* identity, quadratic, cubic, square-potential, exponential, and logarithmic.
### K-Means for dense and sparse vector data
* minimise sum of squares of l2 distances to cluster mean
* minimise sum of l1 distances to cluster dimension-wise median
## PREREQUISITES
* CMake
* for the Python library: Cython and Python
## 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