Socket
Socket
Sign inDemoInstall

sdbscan

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sdbscan

DBSCAN implementation (density based spatial clustering) for javascript. Works in node and browser


Version published
Weekly downloads
16
decreased by-23.81%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

sdbscan

Super fast density based spatial clustering DBSCAN implementation for unidimiensional and multidimensional data. Works on nodejs and browser.

Installation

npm install sdbscan

Usage

NodeJS

const sdbscan = require("sdbscan");

var data = [0, 1, 100, 101, 2, 102, 3, 104, 4, 103, 105, 5];
var res = sdbscan(data,2,3);

Browser

<!doctype html>
<html>
<head>
	<script src="sdbscan.js"></script>
</head>
<body>
	<script>
		var data = [0,1,100,101,2,102,3,104,4,103,105,5];
		var res = sdbscan(data,2,3);

		console.log(data);
		console.log(res);
	</script>
</body>
</html>

Results

{
	"noise": [],
	"clusters": [
    {
      "id": 0,
      "data": [5,4,3,2,1,0]
    },
    {
      "id": 1,
      "data": [105,103,104,102,101,100]
    }
  ]
}

API

sdbscan(data,epsilon,min)

Calculates unidimiensional and multidimensional dbscan clustering on data. Parameters are:

  • data Unidimiensional or multidimensional array of values to be clustered. for unidimiensional data, takes the form of a simple array [1,2,3.....,n]. For multidimensional data, takes a NxM array [[1,2],[2,3]....[n,m]]
  • epsilon Maximum distance for two points to be considered in the same region.
  • min Minimal region size. If a region for a point is lesser than min, this point will be considered as noise (cannot be included in any group).

The function will return an object with the following data:

  • noise Points that cannot be added to any cluster.
  • clusters An array of clusters, with an ID and the data points belonging to it.

Keywords

FAQs

Last updated on 26 Jul 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc