A TypeScript implementation of HDBSCAN (Hierarchical Density-Based Spatial Clustering of Applications with Noise), based on Campello et al. 2017.
HDBSCAN is particularly effective at:
- Detecting clusters of varying densities
- Identifying noise points
- Handling clusters of different shapes
- Providing cluster membership probabilities
npm install hdbscan-ts
import { HDBSCAN } from "hdbscan-ts";
const data = [
[1.1, 2.1],
[2.1, 1.1],
[1.1, 1.1],
[0.1, 1.1],
[10.1, 11.1],
[11.1, 10.1],
[10.1, 10.1]
];
const hdbscan = new HDBSCAN({
minClusterSize: 2
});
const labels = hdbscan.fit(data);
console.log(labels);
// [0, 0, 0, 0, 1, 1, 1]
minClusterSize
(default: 5): Minimum size of clustersminSamples
(default: 5): Minimum number of samples in neighborhooddebugMode
(default: false): Enable debug logging
fit(data: number[][]): HDBSCAN
labels_: number[]
probabilities_: number[]
MIT