tests/testthat/test-agglomerative.R

skip_if_not(run_gpu_tests, "requires the GPU test environment")

context("Agglomerative Clustering")

test_that("cuda_ml_agglomerative_clustering() works as expected", {
  set.seed(0)

  blob_sz <- 50
  blobs <- gen_blobs(blob_sz)
  clusters <- blobs |>
    cuda_ml_agglomerative_clustering(metric = "euclidean", n_clusters = 3L)

  expect_equal(
    clusters$labels,
    c(1L, 2L, 0L) |>
      purrr::map(\(x) rep(x, blob_sz)) |>
      unlist(use.names = FALSE)
  )
})

Try the cuda.ml package in your browser

Any scripts or data that you put into this service are public.

cuda.ml documentation built on Aug. 21, 2026, 9:14 a.m.