
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
@cdxoo/dbscan
Advanced tools
Customizable DBSCAN clustering for arbirary datasets.
npm install --save @cdxoo/dbscan
const dbscan = require('@cdxoo/dbscan');
let simpleResult = dbscan({
dataset: [21,22,23,24, 27,28,29,30, 9001],
epsilon: 1.01,
});
// => {
// clusters: [ [0,1,2,3], [4,5,6,7] ],
// noise: [ 8 ]
//}
let objectResult = dbscan({
dataset: [{ foo: 21 }, { foo: 22 }, { foo: 27 }, { foo: 28 }],
epsilon: 1.1,
distanceFunction: (a,b) => Math.abs(a.foo - b.foo)
});
// => {
// clusters: [ [0,1], [2,3] ],
// noise: []
//}
dbscan({
dataset: [], // An array of datapoints.
// Datapojnts can be anything when you
// use a custom distance function.
epsilon: 1.3, // Maximum distance between datapoints.
// Determine if a datapoint is in a cluster or not.
// Default is 1.0
epsilonCompare: (distance, epsilon) => ( /*...*/ ),
// Custom function to compare calculated
// distance and epsilon. Must return true/false.
// Default is (dist, e) => (dist < e)
distanceFunction: (a, b) => ( /*...*/ ),
// Custom function to calculate the distance
// between two datapoints. Must be given when
// working with higher dimensional datasets,
// or datasets whose items are objects.
// The default function only works on
// one-dimensional data points.
// Defaults is (a, b) => Math.abs(a - b)
minimumPoints: 2,
// Threshold of how many points are needed
// in the same neighborhood to form a cluster.
// Default is 2
})
FAQs
Customizable DBSCAN clustering for arbitrary datasets
We found that @cdxoo/dbscan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.