https://github.com/solzimer/sdbscan
dbscan cluster algorythm for javascript. works in node and browser
https://github.com/solzimer/sdbscan
classification cluster clustering dbscan density groups multidimensional noise spatial unidimensional
Last synced: 6 months ago
JSON representation
dbscan cluster algorythm for javascript. works in node and browser
- Host: GitHub
- URL: https://github.com/solzimer/sdbscan
- Owner: solzimer
- Created: 2017-07-24T09:00:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-28T22:48:12.000Z (over 8 years ago)
- Last Synced: 2025-08-09T15:44:48.977Z (6 months ago)
- Topics: classification, cluster, clustering, dbscan, density, groups, multidimensional, noise, spatial, unidimensional
- Language: JavaScript
- Size: 152 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sdbscan
Super fast density based spatial clustering [DBSCAN](https://en.wikipedia.org/wiki/DBSCAN) implementation for unidimiensional and multidimensional data. Works on nodejs and browser.
## Installation
```
npm install sdbscan
```
## Usage
### NodeJS
```javascript
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
```html
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);
```
## Results
```javascript
{
"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.