These functions provide convenient wrappers to create the three types of
metric functions in yardstick: numeric metrics, class metrics, and
class probability metrics. They add a metric-specific class to fn and
attach a direction attribute. These features are used by metric_set()
and by tune when model tuning.
See Custom performance metrics for more information about creating custom metrics.
Usage
new_class_metric(fn, direction, range = NULL)
new_prob_metric(fn, direction, range = NULL)
new_ordered_prob_metric(fn, direction, range = NULL)
new_numeric_metric(fn, direction, range = NULL)
new_dynamic_survival_metric(fn, direction, range = NULL)
new_integrated_survival_metric(fn, direction, range = NULL)
new_static_survival_metric(fn, direction, range = NULL)
new_linear_pred_survival_metric(fn, direction, range = NULL)
new_quantile_metric(fn, direction, range = NULL)Arguments
- fn
A function. The metric function to attach a metric-specific class and
directionattribute to.- direction
A string. One of:
"maximize""minimize""zero"
- range
An optional numeric vector of length 2 giving the range of possible output values, e.g.
c(0, 1)orc(0, Inf). Use-InfandInffor unbounded ranges.
