tests/testthat/test-instantiation.R

test_that("Only neural networks can be instantiated", {
  inst("Maarufa", ReLU, 5) |> expect_error()
})

test_that("x and input to neural network must match", {
  Prd(2.1, 0.1) |>
    inst(ReLU, 5) |>
    expect_error()
  Prd(2.1, 0.1) |>
    inst(ReLU, c(5, 5)) |>
    expect_no_error()

  Prd(2.1, 0.1) |>
    inst(Sigmoid, c(5, 5)) |>
    expect_no_error()
  Prd(2.1, 0.1) |>
    inst(Tanh, c(5, 5)) |>
    expect_no_error()
})

Try the nnR package in your browser

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

nnR documentation built on May 29, 2024, 2:02 a.m.