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

后端 未结 2 1302
名媛妹妹
名媛妹妹 2021-02-06 13:35

Kindly I need your support to advice a library or a code in vb.net or C#.net that applies the DBSCAN to make Denisty Based Cluster of data . I have a GPS data , and I want to fi

2条回答
  •  梦毁少年i
    2021-02-06 14:39

    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

    enter image description here

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

    enter image description here

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

    enter image description here

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

    enter image description here

    Once you went through all the points you stop

提交回复
热议问题