DBSCAN code in C# or vb.net , for Cluster Analysis

余生颓废 提交于 2019-12-03 04:42:32

Not sure that's what you're looking for because the algorithm is very well explain on wikipedia. Do you want an explaination of the algorithm or a translation(or good library) of it in C# ?

You can have a look at general clustering algorithm too.

Algorithm

Let say you chose epsilon and the number of element to start a cluster is 4.

You need to define a distance function, a DBSCAN function and an expand cluster function:

from wikipedia:

DBSCAN(D, eps, MinPts)
   C = 0
   for each unvisited point P in dataset D
      mark P as visited
      N = getNeighbors (P, eps)
      if sizeof(N) < MinPts
         mark P as NOISE
      else
         C = next cluster
         expandCluster(P, N, C, eps, MinPts)

expandCluster(P, N, C, eps, MinPts)
   add P to cluster C
   for each point P' in N 
      if P' is not visited
         mark P' as visited
         N' = getNeighbors(P', eps)
         if sizeof(N') >= MinPts
            N = N joined with N'
      if P' is not yet member of any cluster
         add P' to cluster C

You have a list of points:

First: select a point randomly :

Test in epsilon (Epsilon is the radius of the circles) if the number of point is 4. If yes start a cluster (green) otherwise mark as noise (red):(fonction DBSCAN for each unvisited point) The arrows show all the points you visited

secondly: Expand cluster : once you find a cluster mark all the point green and check for more points in this cluster

NOTE: a formerly noise point can be changed to green if in a cluster

the 2 red point are actually in a cluster ...

Once you went through all the points you stop

OPTICS, an extension of DBSCAN that does away with the sometimes hard to choose epsilon parameter (but that may actually be rather easy for you, as you have geo data - just set it to 1 km or whatever you consider sensible).

It's a fairly nice and powerful extension of DBSCAN, but unfortunately also a bit harder to implement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!