tests/testthat/test-agglomerative.R

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(~ rep(.x, blob_sz)) %>%
      purrr::flatten_int()
  )
})

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 Jan. 8, 2022, 9:06 a.m.