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))
})

Try the diceR package in your browser

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

diceR documentation built on Sept. 29, 2023, 1:06 a.m.