Nothing
#' @title Convert a Ratio Hyperparameter
#'
#' @description
#' Given the named list `pv` (values of a [ParamSet]), converts a possibly provided hyperparameter
#' called `ratio` to an integer hyperparameter `target`.
#' If both are found in `pv`, an exception is thrown.
#'
#' @param pv (named `list()`).
#' @param target (`character(1)`)\cr
#' Name of the integer hyperparameter.
#' @param ratio (`character(1)`)\cr
#' Name of the ratio hyperparameter.
#' @param n (`integer(1)`)\cr
#' Ratio of what?
#'
#' @return (named `list()`) with new hyperparameter settings.
#' @noRd
convert_ratio = function(pv, target, ratio, n) {
switch(to_decimal(c(target, ratio) %in% names(pv)) + 1L,
# !mtry && !mtry.ratio
pv,
# !mtry && mtry.ratio
{
pv[[target]] = max(ceiling(pv[[ratio]] * n), 1)
remove_named(pv, ratio)
},
# mtry && !mtry.ratio
pv,
# mtry && mtry.ratio
stopf("Hyperparameters '%s' and '%s' are mutually exclusive", target, ratio)
)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.