🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

density-clustering

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

density-clustering

Density Based Clustering in JavaScript

1.3.0
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

76

Maintenance

100

License

Version published
Weekly downloads
426K
-6.33%
Maintainers
1
Weekly downloads
 
Created

What is density-clustering?

The density-clustering npm package provides algorithms for clustering data points based on their density. It includes popular clustering algorithms such as DBSCAN, OPTICS, and KMEANS, which are useful for identifying clusters in data sets where the clusters may have irregular shapes or varying densities.

What are density-clustering's main functionalities?

DBSCAN

DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a popular clustering algorithm that groups together points that are closely packed together, marking as outliers points that lie alone in low-density regions. The code sample demonstrates how to use the DBSCAN algorithm to cluster a simple dataset.

const clustering = require('density-clustering');
const dbscan = new clustering.DBSCAN();
const dataset = [[1,2], [2,3], [2,2], [8,7], [8,8], [25,80]];
const clusters = dbscan.run(dataset, 2, 2);
console.log(clusters);

OPTICS

OPTICS (Ordering Points To Identify the Clustering Structure) is an algorithm that creates an ordering of the database that represents its density-based clustering structure. The code sample shows how to use the OPTICS algorithm to cluster a dataset.

const clustering = require('density-clustering');
const optics = new clustering.OPTICS();
const dataset = [[1,2], [2,3], [2,2], [8,7], [8,8], [25,80]];
const clusters = optics.run(dataset, 2, 2);
console.log(clusters);

KMEANS

KMEANS is a well-known clustering algorithm that partitions the dataset into K clusters, where each data point belongs to the cluster with the nearest mean. The code sample demonstrates how to use the KMEANS algorithm to cluster a dataset into 3 clusters.

const clustering = require('density-clustering');
const kmeans = new clustering.KMEANS();
const dataset = [[1,2], [2,3], [2,2], [8,7], [8,8], [25,80]];
const clusters = kmeans.run(dataset, 3);
console.log(clusters);

Other packages similar to density-clustering

FAQs

Package last updated on 23 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts