Skip to content

Commit

Permalink
removed comments about is.nan.vec from test-tuning.R
Browse files Browse the repository at this point in the history
  • Loading branch information
danielturek committed Jan 30, 2024
1 parent d8c8340 commit 58d7435
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions nimbleHMC/tests/testthat/test-tuning.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,12 @@ test_that('variance (mass) adaptation windows are set correctly', {
expect_error(sNUTS$before_chain(2000, 0, 1))
sNUTS$before_chain(2000, 0, 2)

## conf <- configureMCMC(Rmodel, nodes = NULL)
## conf$addSampler('a', "NUTS_classic", control = list(warmupMode = 'iterations', warmup = 0))
## Rmcmc <- buildMCMC(conf)
## sNUTS <- Rmcmc$samplerFunctions[[1]]
## sNUTS$before_chain(2000, 0, 2)
## Rmcmc$run(niter = 1)
## Errors out due to is.nan.vec: not a nimbleHMC issue
conf <- configureMCMC(Rmodel, nodes = NULL)
conf$addSampler('a', "NUTS_classic", control = list(warmupMode = 'iterations', warmup = 0))
Rmcmc <- buildMCMC(conf)
sNUTS <- Rmcmc$samplerFunctions[[1]]
sNUTS$before_chain(2000, 0, 2)
Rmcmc$run(niter = 1)
})

test_that('epsilon and M adaptation vs not cases are handled correctly', {
Expand Down Expand Up @@ -299,14 +298,6 @@ test_that('epsilon and M adaptation vs not cases are handled correctly', {
expect_false(sNUTS$epsilon == 0.5)
expect_true(all(sNUTS$M == 1))

# NUTS_classic
# At the time of this writing,
# a bug in nimble waiting to be fixed is that is.nan.vec
# is not exported for uncompild execution. For these tests,
# we grab it here so it can be called during initEpsilon:
is.nan.vec <- nimble:::is.nan.vec
temporarilyAssignInGlobalEnv(is.nan.vec)

#A
set.seed(2)
conf <- configureMCMC(Rmodel, nodes = NULL)
Expand Down

0 comments on commit 58d7435

Please sign in to comment.