| cuda_ml_dbscan | R Documentation |
Run the DBSCAN (Density-based spatial clustering of applications with noise) clustering algorithm.
cuda_ml_dbscan(x, min_pts, eps)
x |
The input matrix or data frame. Each data point should be a row and should consist of numeric values only. |
min_pts, eps |
A point |
A list containing the cluster assignments of all data points. A data
point not belonging to any cluster (i.e., "noise") will have NA as its
cluster assignment.
library(cuda.ml)
if (interactive() && cuda_ml_backend_info()$runtime_installed) {
gen_pts <- function() {
centroids <- list(c(1000, 1000), c(-1000, -1000), c(-1000, 1000))
pts <- centroids |>
purrr::map(\(centroid) {
MASS::mvrnorm(10, mu = centroid, Sigma = diag(2))
})
do.call(rbind, pts)
}
m <- gen_pts()
clusters <- cuda_ml_dbscan(m, min_pts = 5, eps = 3)
print(clusters)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.