Internal function to add white noise to a encoded predictor to reduce the risk of overfitting when used in a model along with the response.
add_white_noise(
df = NULL,
response = NULL,
predictor = NULL,
white_noise = 0,
seed = 1
)data frame
(required; data frame, tibble, or sf) A data frame with responses and predictors. Default: NULL.
(optional, character string) Name of a numeric response variable in df. Default: NULL.
(required, string) Name of a target-encoded predictor. Default: NULL
(optional; numeric vector) Argument of the methods "mean", "rank", and "loo". Maximum white noise to add, expressed as a fraction of the range of the response variable. Range from 0 to 1. Default: 0.
(optional; integer vector) Random seed to facilitate reproducibility when white_noise is not 0. If NULL, the function selects one at random, and the selected seed does not appear in the encoded variable names. Default: 0
Other target_encoding_tools:
encoded_predictor_name()