tests/testthat/test_loss.R

testthat::context("calculating the loss for matrices L and R")

testthat::test_that("matrices with integer results", {
  res1 <- loss(
    L = matrix(c(1, 2)), R = t(matrix(c(3, 4))),
    D = matrix(c(1, 1, 1, 1), nrow = 2),
    lambda = 0.2
  )
  testthat::expect_equal(res1$loss, 93)
  testthat::expect_equal(res1$error_matrix, matrix(c(-2, -5, -3, -7), ncol = 2))
})

Try the BEclear package in your browser

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

BEclear documentation built on Nov. 8, 2020, 8:07 p.m.