-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The stochtree R package attempts to respect user-provided random seeds without modifying the global RNG state by caching the user's pre-existing .Random.seed and resetting the random number generator based on this seed after stochtree::bart() or stochtree::bcf() has run.
This is a problem if a user's session hasn't set .Random.seed (either by calling set.seed() or running a random number generation function like runif()).
Reproducing
- Save the following lines to an R script called
example.Rwith
library(stochtree)
data(iris)
y <- iris$Sepal.Length
X <- iris[, c("Sepal.Width", "Petal.Length", "Petal.Width")]
bart_model <- bart(
X_train = X,
y_train = y,
general_params = list(random_seed = 1234)
)
- Run at the command line
Rscript example.R
Expected behavior
This should not throw an error, bart() and bcf() should be robust to NULL-valued .Random.seed
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working