Skip to content

Commit

Permalink
add tests for if random sample is higher than possible combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Oct 10, 2022
1 parent 599737e commit ee09f83
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/testthat/test-MLP.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@ test_that("MLP nn-module works ", {
# model works without numeric variables
expect_equal(output$shape, 10)
})


test_that("Errors are produced by settings function", {
randomSample <- 2

expect_error(setMultiLayerPerceptron(
numLayers = 1,
sizeHidden = 128,
dropout = 0.0,
sizeEmbedding = 128,
weightDecay = 1e-6,
learningRate = 0.01,
seed = 42,
hyperParamSearch = 'random',
randomSample = randomSample))

})
17 changes: 17 additions & 0 deletions tests/testthat/test-ResNet.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,20 @@ test_that("Default Resnet works", {
expect_equal(params$sizeEmbedding, 256)

})

test_that("Errors are produced by settings function", {
randomSample <- 2

expect_error(setResNet(
numLayers = 1,
sizeHidden = 128,
hiddenFactor = 1,
residualDropout = 0.0,
hiddenDropout = 0.0,
sizeEmbedding = 128,
weightDecay = 1e-6,
learningRate = 0.01,
seed = 42,
hyperParamSearch = 'random',
randomSample = randomSample))
})
6 changes: 6 additions & 0 deletions tests/testthat/test-Transformer.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@ test_that("Default Transformer works", {

expect_equal(settings$name, 'defaultTransformer')
})

test_that("Errors are produced by settings function", {
randomSample <- 2

expect_error(setTransformer(randomSample = randomSample))
})

0 comments on commit ee09f83

Please sign in to comment.