Skip to content

Commit 39c2f4f

Browse files
committed
Address requests
1 parent c36f280 commit 39c2f4f

8 files changed

Lines changed: 21 additions & 24 deletions

R/args.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ CmdStanArgs <- R6::R6Class(
119119
if (type == "output" && !is.null(self$output_basename)) {
120120
basename <- self$output_basename
121121
}
122-
123122
generate_file_names(
124123
basename = basename,
125124
ext = ".csv",
@@ -195,7 +194,6 @@ CmdStanArgs <- R6::R6Class(
195194
if (!is.null(self$num_threads)) {
196195
num_threads <- c(args$output, paste0("num_threads=", self$num_threads))
197196
}
198-
199197
args <- do.call(c, append(args, list(use.names = FALSE)))
200198
self$method_args$compose(idx, args)
201199
},
@@ -709,7 +707,6 @@ validate_cmdstan_args <- function(self) {
709707
if (!is.null(self$data_file)) {
710708
assert_file_exists(self$data_file, access = "r")
711709
}
712-
713710
num_procs <- length(self$proc_ids)
714711
if (inherits(self$method_args, "PathfinderArgs")) {
715712
num_inits <- self$method_args$num_paths

R/model.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,8 @@ sample <- function(data = NULL,
11491149
show_messages = TRUE,
11501150
show_exceptions = TRUE,
11511151
diagnostics = c("divergences", "treedepth", "ebfmi"),
1152-
save_metric = TRUE,
1153-
save_cmdstan_config = TRUE,
1152+
save_metric = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL),
1153+
save_cmdstan_config = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL),
11541154
# deprecated
11551155
cores = NULL,
11561156
num_cores = NULL,
@@ -1243,7 +1243,7 @@ sample <- function(data = NULL,
12431243
window = window,
12441244
fixed_param = fixed_param,
12451245
diagnostics = diagnostics,
1246-
save_metric = if (cmdstan_version() > "2.34.0") save_metric else NULL
1246+
save_metric = save_metric
12471247
)
12481248
args <- CmdStanArgs$new(
12491249
method_args = sample_args,
@@ -1264,7 +1264,7 @@ sample <- function(data = NULL,
12641264
sig_figs = sig_figs,
12651265
opencl_ids = assert_valid_opencl(opencl_ids, self$cpp_options()),
12661266
model_variables = model_variables,
1267-
save_cmdstan_config = if (cmdstan_version() > "2.34.0") save_cmdstan_config
1267+
save_cmdstan_config = save_cmdstan_config
12681268
)
12691269
runset <- CmdStanRun$new(args, procs)
12701270
runset$run_cmdstan()
@@ -1361,7 +1361,7 @@ sample_mpi <- function(data = NULL,
13611361
show_messages = TRUE,
13621362
show_exceptions = TRUE,
13631363
diagnostics = c("divergences", "treedepth", "ebfmi"),
1364-
save_cmdstan_config = TRUE,
1364+
save_cmdstan_config = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL),
13651365
# deprecated
13661366
validate_csv = TRUE) {
13671367

@@ -1426,7 +1426,7 @@ sample_mpi <- function(data = NULL,
14261426
output_basename = output_basename,
14271427
sig_figs = sig_figs,
14281428
model_variables = model_variables,
1429-
save_cmdstan_config = if (cmdstan_version() > "2.34.0") save_cmdstan_config
1429+
save_cmdstan_config = save_cmdstan_config
14301430
)
14311431
runset <- CmdStanRun$new(args, procs)
14321432
runset$run_cmdstan_mpi(mpi_cmd, mpi_args)
@@ -1507,7 +1507,7 @@ optimize <- function(data = NULL,
15071507
history_size = NULL,
15081508
show_messages = TRUE,
15091509
show_exceptions = TRUE,
1510-
save_cmdstan_config = TRUE) {
1510+
save_cmdstan_config = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL)) {
15111511
procs <- CmdStanProcs$new(
15121512
num_procs = 1,
15131513
show_stderr_messages = show_exceptions,
@@ -1549,7 +1549,7 @@ optimize <- function(data = NULL,
15491549
sig_figs = sig_figs,
15501550
opencl_ids = assert_valid_opencl(opencl_ids, self$cpp_options()),
15511551
model_variables = model_variables,
1552-
save_cmdstan_config = if (cmdstan_version() > "2.34.0") save_cmdstan_config
1552+
save_cmdstan_config = save_cmdstan_config
15531553
)
15541554
runset <- CmdStanRun$new(args, procs)
15551555
runset$run_cmdstan()
@@ -1641,7 +1641,7 @@ laplace <- function(data = NULL,
16411641
draws = NULL,
16421642
show_messages = TRUE,
16431643
show_exceptions = TRUE,
1644-
save_cmdstan_config = TRUE) {
1644+
save_cmdstan_config = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL)) {
16451645
if (cmdstan_version() < "2.32") {
16461646
stop("This method is only available in cmdstan >= 2.32", call. = FALSE)
16471647
}
@@ -1716,7 +1716,7 @@ laplace <- function(data = NULL,
17161716
sig_figs = sig_figs,
17171717
opencl_ids = assert_valid_opencl(opencl_ids, self$cpp_options()),
17181718
model_variables = model_variables,
1719-
save_cmdstan_config = if (cmdstan_version() > "2.34.0") save_cmdstan_config
1719+
save_cmdstan_config = save_cmdstan_config
17201720
)
17211721
runset <- CmdStanRun$new(args, procs)
17221722
runset$run_cmdstan()
@@ -1797,7 +1797,7 @@ variational <- function(data = NULL,
17971797
draws = NULL,
17981798
show_messages = TRUE,
17991799
show_exceptions = TRUE,
1800-
save_cmdstan_config = TRUE) {
1800+
save_cmdstan_config = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL)) {
18011801
procs <- CmdStanProcs$new(
18021802
num_procs = 1,
18031803
show_stderr_messages = show_exceptions,
@@ -1839,7 +1839,7 @@ variational <- function(data = NULL,
18391839
sig_figs = sig_figs,
18401840
opencl_ids = assert_valid_opencl(opencl_ids, self$cpp_options()),
18411841
model_variables = model_variables,
1842-
save_cmdstan_config = if (cmdstan_version() > "2.34.0") save_cmdstan_config
1842+
save_cmdstan_config = save_cmdstan_config
18431843
)
18441844
runset <- CmdStanRun$new(args, procs)
18451845
runset$run_cmdstan()
@@ -1942,7 +1942,7 @@ pathfinder <- function(data = NULL,
19421942
calculate_lp = NULL,
19431943
show_messages = TRUE,
19441944
show_exceptions = TRUE,
1945-
save_cmdstan_config = TRUE) {
1945+
save_cmdstan_config = ifelse(cmdstan_version() > "2.34.0", TRUE, NULL)) {
19461946
procs <- CmdStanProcs$new(
19471947
num_procs = 1,
19481948
show_stderr_messages = show_exceptions,
@@ -1990,7 +1990,7 @@ pathfinder <- function(data = NULL,
19901990
opencl_ids = assert_valid_opencl(opencl_ids, self$cpp_options()),
19911991
model_variables = model_variables,
19921992
num_threads = num_threads,
1993-
save_cmdstan_config = if (cmdstan_version() > "2.34.0") save_cmdstan_config
1993+
save_cmdstan_config = save_cmdstan_config
19941994
)
19951995
runset <- CmdStanRun$new(args, procs)
19961996
runset$run_cmdstan()

man/model-method-laplace.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model-method-optimize.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model-method-pathfinder.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model-method-sample.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model-method-sample_mpi.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model-method-variational.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)