Choosing eps and minpts for DBSCAN (R)?

后端 未结 6 2072
醉酒成梦
醉酒成梦 2020-12-23 12:06

I\'ve been searching for an answer for this question for quite a while, so I\'m hoping someone can help me. I\'m using dbscan from the fpc library in R. For example, I am

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 12:35

    If you have the resources, you can also test a bunch of epsilon and minPts values and see what works. I do this using expand.grid and mapply.

    # Establish search parameters.
    k <- c(25, 50, 100, 200, 500, 1000)
    eps <- c(0.001, 0.01, 0.02, 0.05, 0.1, 0.2)
    
    # Perform grid search.
    grid <- expand.grid(k = k, eps = eps)
    
    results <- mapply(grid$k, grid$eps, FUN = function(k, eps) {
      cluster <- dbscan(data, minPts = k, eps = eps)$cluster
      sum <- table(cluster)
      cat(c("k =", k, "; eps =", eps, ";", sum, "\n"))
    })
    

提交回复
热议问题