Register a metric function.
register_metric(
name,
fun,
direction = c("maximize", "minimize"),
label = name,
cutoff_dependent = FALSE,
overwrite = FALSE
)Unique identifier for the metric.
Function implementing the metric. Must accept at least the arguments
truth, scores, and selected.
Either "maximize" or "minimize".
Human-readable name.
Logical; if TRUE, the metric depends on a probability
cutoff for classification (e.g., sensitivity, specificity). Cutoff-dependent
metrics may not behave as expected in min_metric_constraint() because
their values depend on the arbitrary cutoff_prob parameter.
Logical; set to TRUE to replace an existing registration.
Invisibly, the registered name.