@@ -1021,8 +1021,12 @@ validate_exe_file <- function(exe_file) {
1021
1021
# ' @param num_procs Number of CmdStan processes.
1022
1022
# ' @param model_variables A list of all parameters with their types and
1023
1023
# ' number of dimensions. Typically the output of model$variables().
1024
+ # ' @param warn_partial Should a warning be thrown if inits are only specified
1025
+ # ' for a subset of parameters? Can be controlled by global option
1026
+ # ' `cmdstanr_warn_inits`.
1024
1027
# ' @return A character vector of file paths.
1025
- process_init_list <- function (init , num_procs , model_variables = NULL ) {
1028
+ process_init_list <- function (init , num_procs , model_variables = NULL ,
1029
+ warn_partial = getOption(" cmdstanr_warn_inits" , TRUE )) {
1026
1030
if (! all(sapply(init , function (x ) is.list(x ) && ! is.data.frame(x )))) {
1027
1031
stop(" If 'init' is a list it must be a list of lists." , call. = FALSE )
1028
1032
}
@@ -1048,7 +1052,7 @@ process_init_list <- function(init, num_procs, model_variables = NULL) {
1048
1052
}
1049
1053
}
1050
1054
}
1051
- if (length(missing_parameter_values ) > 0 ) {
1055
+ if (length(missing_parameter_values ) > 0 && isTRUE( warn_partial ) ) {
1052
1056
warning_message <- c(
1053
1057
" Init values were only set for a subset of parameters. \n Missing init values for the following parameters:\n "
1054
1058
)
@@ -1062,6 +1066,7 @@ process_init_list <- function(init, num_procs, model_variables = NULL) {
1062
1066
warning_message <- c(warning_message , paste0(line_text , paste0(missing_parameter_values [[i ]], collapse = " , " ), " \n " ))
1063
1067
}
1064
1068
}
1069
+ warning_message <- c(warning_message , " \n To disable this message use options(cmdstanr_warn_inits = FALSE).\n " )
1065
1070
message(warning_message )
1066
1071
}
1067
1072
}
0 commit comments