tests/testthat/test-external_validity.R

set.seed(1)
x <- sample(1:4, 100, replace = TRUE)
y1 <- sample(1:4, 100, replace = TRUE)
y2 <- sample(1:3, 100, replace = TRUE)

test_that("normalized mutual information works", {
  expect_error(ev_nmi(x, y1), NA)
})

test_that("error if different number of unique labels", {
  expect_error(ev_confmat(x, y1), NA)
  expect_error(ev_confmat(x, y2))
})
AlineTalhouk/diceR documentation built on Jan. 28, 2024, 4:06 p.m.