HDBScan
API and practical guide for HDBScan in @kanaries/ml, including when to use it in JavaScript and TypeScript ML workflows.
Clusters.HDBScan
constructor(
min_cluster_size: number = 5,
min_samples: number | null = null,
cluster_selection_epsilon: number = 0.5,
metric: Distance.IDistanceType = 'euclidiean'
)fitPredict(samplesX: number[][]): number[] returns cluster labels. Noise points are marked as -1.
This is a simplified implementation that internally calls DBSCAN using cluster_selection_epsilon as the eps parameter.
const hdb = new HDBScan(5, null, 0.6);
const labels = hdb.fitPredict(X);Practical guide: HDBScan in JavaScript and TypeScript
HDBScan finds clusters with varying density and identifies noise points without forcing every point into a cluster.
When to use HDBScan
- Cluster shapes are irregular and density changes across regions.
- Outlier/noise detection is important for your downstream workflow.
- You do not know an exact cluster count in advance.
Implementation workflow
- Scale features so distance comparisons are meaningful.
- Fit the model and inspect cluster labels plus noise assignments.
- Use cluster stability and business metrics to tune density settings.
JavaScript deployment notes
- Prefer feature scaling for distance-based and gradient-based algorithms to improve stability.
- In browser apps, run heavy training in Web Workers to keep UI interactions smooth.
- Keep a simple baseline from the same module as a fallback model for comparison.
Search intents this page targets
HDBScan JavaScriptHDBScan TypeScriptHDBScan browser machine learning@kanaries/ml HDBScan
FAQ
What problem does HDBScan solve in JavaScript machine learning projects?
HDBScan helps teams implement production-ready ML workflows in browser and Node.js environments with a familiar scikit-learn-style API.
When should I choose HDBScan instead of other Clusters algorithms?
Use HDBScan when it best matches your data shape, labeling strategy, and runtime constraints. Benchmark against at least one alternative in the same module before finalizing defaults.
Can I run HDBScan in both browser and Node.js with @kanaries/ml?
Yes. @kanaries/ml is designed for JavaScript and TypeScript runtimes across browser applications, server-side Node.js services, and edge-friendly workflows.
Clusters
Learn how to use Clusters algorithms in @kanaries/ml for JavaScript and TypeScript machine learning projects.
K-Means Clustering (KMeans) – @kanaries/ml Algorithm Guide
Learn how to apply the K-Means clustering algorithm with @kanaries/ml, including parameter definitions, TypeScript API usage, and examples for segmenting datasets in modern web apps.