uhho / density-clustering

Density Based Clustering in JavaScript
MIT License
214 stars 33 forks source link

DBScan - am I understandig it wrong? #3

Closed frankred closed 9 years ago

frankred commented 10 years ago

Hi again,

I run DBScan on the following data: [0,1,2,3,4,5,6,390,393,396,399,402,405]

with the following configuration:

new DBSCAN(dbscan_data, 8, 2, function (x1, x2) {
    return Math.abs(x1 - x2);
});

The output is: [[0,1,2,3,4,5,6],[7,8,9],[10,11],[12]] related to my data this are the clusters:

0,1,2,3,4,5,6 | 390,393,396 | 399,402 | 405

Shouldn't it be?:

0,1,2,3,4,5,6 | 390,393,396, 399,402, 405

If not do you know what clustering this is? I thought every point is connected by another point if the distance < 8. I would be so happy if I get an answer :)

uhho commented 9 years ago

@frankred Extremely sorry for late response. Recently I had some time, so I focused on DBSCAN algorithm again and... yes, I found a bug in function responsible for expanding cluster.

I fixed it and test with your code, everything works fine now. You can download latest release (1.0.3) from npm.

frankred commented 9 years ago

No problem I solved it by writing my own clustering ;) Long live JS. AD: https://github.com/frankred/frankyfourfinger-1d-n-sorted-classifier