bound_prediction: Truncate a numeric prediction column

View source: R/bound_prediction.R

bound_predictionR Documentation

Truncate a numeric prediction column

Description

For user-defined lower_limit and/or upper_limit bound, ensure that the values in the .pred column are coerced to these bounds.

Usage

bound_prediction(
  x,
  lower_limit = -Inf,
  upper_limit = Inf,
  call = rlang::current_env()
)

Arguments

x

A data frame that contains a numeric column named .pred.

lower_limit, upper_limit

Single numerics (or NA) that define constraints on .pred.

call

The call to be displayed in warnings or errors.

Value

x with potentially adjusted values.

Examples

data(solubility_test, package = "yardstick")

names(solubility_test) <- c("solubility", ".pred")

bound_prediction(solubility_test, lower_limit = -1)

topepo/probably documentation built on April 6, 2024, 7:32 p.m.