Skip to content

Commit

Permalink
tweak dDHMM AD test tolderance
Browse files Browse the repository at this point in the history
  • Loading branch information
perrydv committed Jun 23, 2024
1 parent e58ce4e commit ec6be9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion inst/AD_test_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,17 @@ test_AD2_oneCall <- function(Robj, Cobj,
c("C", "R")[as.integer(grepl("^R", names(ansSet)))+1])
RansSet <- splitAnsSet[["R"]]
CansSet <- splitAnsSet[["C"]]
if(pass)
if(length(RansSet) > 1) {
pass <- pass && all_equal_list(RansSet[[1]], RansSet[-1], tol = RRrelTol[[o]],
abs_threshold = RRabsThresh,
info = paste0("(RR order ", o,")"))
if(!pass) {
cat(paste('Some R-to-R derivatives do not match for order',o))
browser()
# browser()
}
}
if(pass)
if(length(RansSet) > 0 && length(CansSet) > 0) {
pass <- pass && all_equal_list(RansSet[[1]], CansSet, tol = RCrelTol[[o]],
abs_threshold = RCabsThresh,
Expand All @@ -308,6 +310,7 @@ test_AD2_oneCall <- function(Robj, Cobj,
browser()
}
}
if(pass)
if(length(CansSet) > 1) {
pass <- pass && all_equal_list(CansSet[[1]], CansSet[-1], CCrelTol[[o]],
abs_threshold = CCabsThresh,
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-AD.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ test_that ("dNmixture works with AD", {
Cmodel <- compileNimble(Rmodel)
Cmodel$calculate()


nodesList_case1 <- setup_update_and_constant_nodes_for_tests(Rmodel, c('prob', 'lambda', 'theta', 's'))
v1_case1 <- list(arg1 = c(prob, lambda, theta, s)) # taping values for prob and lambda
v2_case1 <- list(arg1 = c(prob2, lambda2, theta2, s2)) # testing values for prob and lambda
Expand Down Expand Up @@ -983,7 +982,7 @@ test_that("dDHMM works with AD", {
res <- model_calculate_test_case(Rmodel, Cmodel, deriv_nf = model_calculate_test,
nodesList = nodesList_case1, v1 = v1_case1, v2 = v2_case1,
order = 0:2,
RCrelTol = c(3e-15, 1e-8, 1e-3, 1e-14))
RCrelTol = c(3e-15, 1e-8, 2e-3, 1e-14))
#######


Expand Down

0 comments on commit ec6be9e

Please sign in to comment.