UNPKG

als-statistics

Version:

A powerful and lightweight JavaScript library for descriptive statistics, regression, clustering, outlier detection, and noise analysis using a flexible table/column architecture.

32 lines (23 loc) 960 B
## 📊 DBSCAN Clustering `dbscan(eps, minPts)` identifies clusters of correlated numeric columns using DBSCAN (Density-Based Spatial Clustering of Applications with Noise). ### 🔹 Parameters - `eps` (default: `0.4`) — maximum distance between columns to be considered neighbors. - `minPts` (default: `3`) — minimum number of neighbors to form a dense region (cluster). ### 🔹 Usage ```js const table = Statistics.newTable({ A: [1, 2, 3], B: [10, 20, 30], C: [5, 10, 15] }); const dbscan = table.dbscan(0.5, 2); console.log(dbscan.labels); // Example: [1, 1, -1] console.log(dbscan.clusters); // Array of clustered Table instances ``` ### 🔹 Output - `labels`: Array assigning a cluster ID or `-1` for noise to each column. - `clusters`: Array of new `Table` instances, one per cluster. ### 🔹 How It Works - Measures correlation between numeric columns. - Builds pairwise distances. - Expands clusters around dense areas.