Density Based Clustering Algorithms

1.3.0 · maintenance · verified Sun Apr 19

This JavaScript package provides implementations of popular cluster analysis algorithms, including DBSCAN (Density-Based Spatial Clustering of Applications with Noise), OPTICS (Ordering Points To Identify the Clustering Structure), and K-Means. Currently at version 1.3.0, the package appears to be in a maintenance state, primarily supporting CommonJS environments as indicated by its examples and `bower` installation instructions, which suggest it hasn't fully adopted modern ESM practices or aggressive development cycles. A key differentiator is its direct, unopinionated implementation of these core algorithms for data mining and statistical analysis. While DBSCAN and OPTICS are true density-based methods, K-Means is included for broader utility, though it's important to note it does not rely on density for clustering. The library focuses on providing these fundamental tools for data scientists and developers working with clustering tasks.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to initialize and run the DBSCAN algorithm on a sample dataset, logging the identified clusters and noise points.

const dataset = [
    [1,1],[0,1],[1,0],
    [10,10],[10,13],[13,13],
    [54,54],[55,55],[89,89],[57,55]
];

const clustering = require('density-clustering');
const dbscan = new clustering.DBSCAN();
// parameters: 5 - neighborhood radius, 2 - number of points in neighborhood to form a cluster
const clusters = dbscan.run(dataset, 5, 2);
console.log('Clusters:', clusters);
console.log('Noise points:', dbscan.noise);

/* Expected Output:
Clusters: [
    [0,1,2],
    [3,4,5],
    [6,7,9]
]
Noise points: [ 8 ]
*/

view raw JSON →