# NOT RUN {
library(cuml)
library(MASS)
library(magrittr)
library(purrr)
set.seed(0L)
gen_pts <- function() {
centers <- list(c(1000, 1000), c(-1000, -1000), c(-1000, 1000))
pts <- centers %>%
map(~ mvrnorm(50, mu = .x, Sigma = matrix(c(1, 0, 0, 1), nrow = 2)))
rlang::exec(rbind, !!!pts) %>% as.matrix()
}
clust <- cuml_agglomerative_clustering(
x = gen_pts(),
metric = "euclidean",
n_clusters = 3L
)
print(clust$labels)
# }
Run the code above in your browser using DataLab