Skip to content

Commit 66f7f51

Browse files
committed
feat: informative warning when calibration_contraint is out of bounds #275
1 parent 85079a8 commit 66f7f51

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

R/R/checks.R

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,18 @@ check_filedir <- function(plot_folder) {
452452
check_calibconstr <- function(calibration_constraint, iterations, trials, calibration_input) {
453453
if (!is.null(calibration_input)) {
454454
total_iters <- iterations * trials
455-
if (calibration_constraint < 0.01 | calibration_constraint > 0.1) {
455+
if (calibration_constraint < 0.01 || calibration_constraint > 0.1) {
456+
message("calibration_constraint must be >=0.01 and <=0.1. Changed to default value: 0.1")
456457
calibration_constraint <- 0.1
457-
message("calibration_constraint must be >=0.01 and <=0.1. Using default value 0.1")
458-
} else if (total_iters * calibration_constraint < 500) {
459-
warning("Calibration constraint set to be top ", calibration_constraint*100, "% calibrated models.",
460-
" Only ", round(total_iters*calibration_constraint,0), " models left for pareto-optimal selection")
458+
}
459+
models_lower <- 500
460+
if (total_iters * calibration_constraint < models_lower) {
461+
warning(sprintf(paste(
462+
"calibration_constraint set for top %s%% calibrated models.",
463+
"%s models left for pareto-optimal selection. Minimum suggested: %s"),
464+
calibration_constraint * 100,
465+
round(total_iters * calibration_constraint, 0),
466+
models_lower))
461467
}
462468
}
463469
return(calibration_constraint)

0 commit comments

Comments
 (0)