FLASC - Flare-Sensitive Clustering, adds an efficient post-processing step to the HDBSCAN* density-based clustering algorithm to detect branching structures within clusters.
The algorithm adds two parameters that may need tuning with respect to HDBSCAN*, but both are intuitive to tune: minimum branch size and branch selection strategy.
The FLASC package is closely based on the HDBSCAN* package and supports the same API, except sparse inputs, which are not supported yet.
from flasc import FLASC
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
data = np.load('./notebooks/data/flared/flared_clusterable_data.npy')
clusterer = FLASC(min_cluster_size=15)
clusterer.fit(data)
colors = sns.color_palette('tab10', 10)
point_colors = [
sns.desaturate(colors[l], p)
for l, p in zip(clusterer.labels_, clusterer.probabilities_)
]
plt.scatter(data[:, 0], data[:, 1], 2, point_colors, alpha=0.5)
plt.axis('off')
plt.show()
A notebook demonstrating how the algorithm works is available at How FLASC Works. The other notebooks demonstrate the algorithm on several data sets and contain the analyses presented in our paper.
Binary wheels are available on PyPI. Presuming you have an up-to-date pip:
pip install pyflasc
For a manual install of the latest code directly from GitHub:
pip install --upgrade git+https://github.com/vda-lab/pyflasc.git#egg=pyflasc
Alternatively download the package, install requirements, and manually run the installer:
wget https://github.com/vda-lab/pyflasc/archive/main.zip
unzip main.zip
rm main.zip
cd flasc-main
pip install -t .
Please cite our publication when using the algorithm:
Bot DM, Peeters J, Liesenborgs J, Aerts J. 2025. FLASC: a flare-sensitive
clustering algorithm. PeerJ Computer Science 11:e2792
https://doi.org/10.7717/peerj-cs.2792
in bibtex:
@article{bot2025flasc,
title = {{FLASC: a flare-sensitive clustering algorithm}},
author = {Bot, Dani{\"{e}}l M. and Peeters, Jannes and Liesenborgs, Jori and Aerts, Jan},
year = {2025},
month = {apr},
journal = {PeerJ Comput. Sci.},
volume = {11},
pages = {e2792},
issn = {2376-5992},
doi = {10.7717/peerj-cs.2792},
url = {https://peerj.com/articles/cs-2792},
}
The FLASC algorithm and software package is closely related to McInnes et al.'s HDBSCAN* software package. We refer to their Journal of Open Source Software article and paper in the ICDMW 2017 proceedings for information on how to cite their software package and high-performance algorithm.
The FLASC package has a 3-Clause BSD license.