diff --git a/R/ml_cov_search.R b/R/ml_cov_search.R
index 708ffbb..5bdcdc4 100644
--- a/R/ml_cov_search.R
+++ b/R/ml_cov_search.R
@@ -62,9 +62,8 @@ ml_cov_search <- function(data, pop_param, cov_continuous, cov_factors, seed = 1
# Check that covariates supplied by user exist in the data
data_validation(data, pop_param, cov_continuous, cov_factors)
- # Set seed
+ # Check if seed is numeric.
stopifnot(is.numeric(seed))
- set.seed(seed)
stopifnot(requireNamespace("caret", quietly = TRUE))
@@ -96,9 +95,8 @@ ml_cov_search <- function(data, pop_param, cov_continuous, cov_factors, seed = 1
pb <- progress::progress_bar$new(
format = "[:bar] :percent :elapsed elapsed / :eta remaining", total = length(pop_param) * 6, clear = FALSE, show_after = 0)
for (i in pop_param) {
+ # Use same seed for each iteration of loop
set.seed(seed)
- my_seed_name <- paste0("seed_", i)
- assign(my_seed_name, .Random.seed, envir = .GlobalEnv)
pb$message(paste0("Searching covariate effects on ", i))
pb$tick()
diff --git a/tests/testthat/_snaps/generate_shap_summary_plot/custom-shap-plots.svg b/tests/testthat/_snaps/generate_shap_summary_plot/custom-shap-plots.svg
index c781129..1c033a8 100644
--- a/tests/testthat/_snaps/generate_shap_summary_plot/custom-shap-plots.svg
+++ b/tests/testthat/_snaps/generate_shap_summary_plot/custom-shap-plots.svg
@@ -21,133 +21,139 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1.3e-01
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1.5e-01
+
-AGE
-
-
-
--0.3
-0.0
-0.3
-Test y-axis
+SEX
+
+
+
+
+
+-0.2
+-0.1
+0.0
+0.1
+0.2
+Test y-axis
Test x-axis
-
-Feature value
-
-
-
-
-
- Low
-High
-Test Title
+
+Feature value
+
+
+
+
+
+ Low
+High
+Test Title
diff --git a/tests/testthat/_snaps/generate_shap_summary_plot/default-shap-plots.svg b/tests/testthat/_snaps/generate_shap_summary_plot/default-shap-plots.svg
index b5597c3..98054a8 100644
--- a/tests/testthat/_snaps/generate_shap_summary_plot/default-shap-plots.svg
+++ b/tests/testthat/_snaps/generate_shap_summary_plot/default-shap-plots.svg
@@ -21,222 +21,228 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0.129
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0.147
+
-AGE
-
-
-
--0.3
-0.0
-0.3
-SHAP value (impact on model output)
-
-Feature value
-
-
-
-
-
- Low
-High
-CL
+SEX
+
+
+
+
+
+-0.2
+-0.1
+0.0
+0.1
+0.2
+SHAP value (impact on model output)
+
+Feature value
+
+
+
+
+
+ Low
+High
+V1