diff --git a/NEWS.md b/NEWS.md index 2c404548..343a3a1c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,8 +2,11 @@ * `prop_terms()` is a new parameter object used for recipes that do supervised feature selection (#395). +* `upper_limit()` and `lower_limit()` now have ranges that are inclusive of the endpoints, unless the endpoint is infinite (#396). + * `batch_size()` now has a specific default parameter range instead of an unknown default range. `get_batch_sizes()` is deprecated (#398). + # dials 1.4.1 * Two new parameters, `cal_method_class()` and `cal_method_reg(),` to control which method is used to calibrate model predictions (#383). diff --git a/R/param_range_limits.R b/R/param_range_limits.R index 9b759531..b1571c9b 100644 --- a/R/param_range_limits.R +++ b/R/param_range_limits.R @@ -13,10 +13,13 @@ #' @rdname range_limits #' @export lower_limit <- function(range = c(-Inf, Inf), trans = NULL) { + inclusive <- c(TRUE, TRUE) + inclusive[is.infinite(range)] <- FALSE + new_quant_param( type = "double", range = range, - inclusive = c(TRUE, FALSE), + inclusive = inclusive, trans = trans, label = c(lower_limit = "Lower Limit"), finalize = NULL @@ -26,10 +29,13 @@ lower_limit <- function(range = c(-Inf, Inf), trans = NULL) { #' @rdname range_limits #' @export upper_limit <- function(range = c(-Inf, Inf), trans = NULL) { + inclusive <- c(TRUE, TRUE) + inclusive[is.infinite(range)] <- FALSE + new_quant_param( type = "double", range = range, - inclusive = c(FALSE, TRUE), + inclusive = inclusive, trans = trans, label = c(upper_limit = "Upper Limit"), finalize = NULL