Hierarchical Density-Based Spatial Clustering of Applications with Noise ("HDBSCAN")
HDBSCAN clustering algorithm in pure Rust. Generic over floating point numeric types.
HDBSCAN is a powerful clustering algorithm that can be used to effectively find clusters in real world data. The main benefits of HDBSCAN are that:
- It does not assume that all data points belong to a cluster, as many clustering algorithms do. I.e. a data set can contain "noise" points. This is important for modelling real world data, which is inherently noisy;
- It allows clusters of varying densities, unlike the plain DBSCAN algorithm which uses a static density threshold. The winning clusters are those that persist the longest at a all densities. This is also crucial for modelling real world data; and
- It makes no assumptions about the number of clusters there have to be, unlike KMeans clustering. The algorithm will select just select the clusters that are the most persistent at all densities.
This implementation owes a debt to the Python scikit-learn implementation of this algorithm, without which this algorithm would not have been possible. The "How HDBSCAN works" article below is invaluable in understanding this algorithm better.
Usage
With default hyper parameters
use Hdbscan;
let data: = vec!;
let clusterer = default;
let result = clusterer.cluster.unwrap;
assert_eq!;
With custom hyper parameters
let data: = vec!;
let hyper_params = builder
.min_cluster_size
.min_samples
.dist_metric
.build;
let clusterer = new;
let result = clusterer.cluster.unwrap;
assert_eq!;
License
Dual-licensed to be compatible with the Rust project.
Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.