tests/testthat/test_utils.R

test_that("logsumexp works", {
  expect_equal(logsumexp(c(log(1))), 0)
  expect_equal(logsumexp(1), 1)
})

test_that("softmax works", {
  expect_equal(softmax(c(1, 1)), c(1 / 2, 1 / 2))
})

Try the rater package in your browser

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

rater documentation built on Sept. 12, 2023, 1:13 a.m.