density-clustering-kdtree-doping
Version:
Doping for https://www.npmjs.com/package/density-clustering
25 lines (22 loc) • 777 B
JavaScript
/**
* Created by Shohei Yokoyama on 2015/06/02.
*/
var dataset = [
[],[0,1],[1,0],
[],[10,11],[11,10],
[],[51,50],[50,51],
[]
];
console.log("OPTICS with KDTree");
var clustering = require('../index.js');
var optics = new clustering.OPTICS_KDTREE();
// parameters: 2 - neighborhood radius, 2 - number of points in neighborhood to form a cluster
var clusters = optics.run(dataset, 2, 2);
var plot = optics.getReachabilityPlot();
console.log(clusters);
console.log("OPTICS with KDTree");
optics = new clustering.OPTICS();
// parameters: 2 - neighborhood radius, 2 - number of points in neighborhood to form a cluster
clusters = optics.run(dataset, 2, 2);
plot = optics.getReachabilityPlot();
console.log(clusters);