fast_density_clustering

Fast local density clustering for low-dimensional data

BSD-3-CLAUSE License

Downloads
171
Stars
7

Fast density clustering (fdc)

A Python package for efficiently clustering low-dimensional data. The core of the algorithm is based on using kernel density maps and density graphs. See below for some specific examples for gaussian mixtures and some test benchmarks that shows the performance against standard clustering algorithms that may be easily imported from sklearn for instance.

Our algorithm solves multiscale problems (multiple variances/densities and population sizes) and works for non-convex clusters. It uses cross-validation and is regularized by two main global parameters : a neighborhood size and a noise threshold measure. The later detects spurious cluster centers while the former guarantees that only local information is used to infer cluster centers. Perhaps one of it's main advantage is that it does not require the user to select the number of clusters and is usually fairly robust to variation of the parameters (within reason!).

The underlying code is based on fast KD-trees for nearest-neighbor searches. For low-dimensional spaces, the algorithm has a O(n log n), where n is the size of the dataset. Is also has a memory complexity of O(n).

Installing

I suggest you install the code using pip from an Anaconda Python 3 environment. From that environment:

git clone https://github.com/alexandreday/fast_density_clustering.git
cd fast_density_clustering
pip install .

That's it ! You can now import the package fdc from your Python scripts. Check out the examples in the file example and see if you can run the scripts provided.

Examples and comparison with other methods

Check out the example for gaussian mixtures (example.py). You should be able to run it directly. It should produce a plot similar to this: alt tag

In another example (example2.py), the algorithm is benchmarked against some sklearn datasets (note that the same parameters are used across all datasets). This is to be compared with other clustering methods easily accesible from sklearn.

Citation

If you use this code in a scientific publication, I would appreciate citation/reference to this repository. Also, for further references on clustering and machine learning check out our machine learning review:

@article{mehta2018high,
  title={A high-bias, low-variance introduction to Machine Learning for physicists},
  author={Mehta, Pankaj and Bukov, Marin and Wang, Ching-Hao and Day, Alexandre GR and Richardson, Clint and Fisher, Charles K and Schwab, David J},
  journal={arXiv preprint arXiv:1803.08823},
  year={2018}
}
Package Rankings
Top 16.45% on Pypi.org
Related Projects