cuml_dbscan: Run the DBSCAN clustering algorithm.

Description Usage Arguments Value Examples

View source: R/dbscan.R

Description

Run the DBSCAN (Density-based spatial clustering of applications with noise) clustering algorithm.

Usage

1
2
3
4
5
6
cuml_dbscan(
  x,
  min_pts,
  eps,
  cuml_log_level = c("off", "critical", "error", "warn", "info", "debug", "trace")
)

Arguments

x

The input matrix or dataframe. Each data point should be a row and should consist of numeric values only.

min_pts, eps

A point 'p' is a core point if at least 'min_pts' are within distance 'eps' from it.

cuml_log_level

Log level within cuML library functions. Must be one of "off", "critical", "error", "warn", "info", "debug", "trace". Default: off.

Value

A list containing the cluster assignments of all data points. A data point not belonging to any cluster (i.e., "noise") will have NA its cluster assignment.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(cuml)
library(magrittr)

gen_pts <- function() {
  centroids <- list(c(1000, 1000), c(-1000, -1000), c(-1000, 1000))

  pts <- centroids %>%
    purrr::map(
      ~ MASS::mvrnorm(10, mu = .x, Sigma = matrix(c(1, 0, 0, 1), nrow = 2))
    )

  rlang::exec(rbind, !!!pts)
}

m <- gen_pts()
clusters <- cuml_dbscan(m, min_pts = 5, eps = 3)

print(clusters)

cuml documentation built on Sept. 21, 2021, 1:06 a.m.

Related to cuml_dbscan in cuml...