Developer function for summarizing new metrics
metric_summarizer()
is useful alongside metric_vec_template()
for
implementing new custom metrics. metric_summarizer()
calls the metric
function inside dplyr::summarise()
. metric_vec_template()
is a
generalized function that calls the core implementation of a metric function,
and includes a number of checks on the types, lengths, and argument inputs.
See vignette("custom-metrics", "yardstick")
for more information.
metric_summarizer( metric_nm, metric_fn, data, truth, estimate, estimator = NULL, na_rm = TRUE, event_level = NULL, ..., metric_fn_options = list() )
metric_nm |
A single character representing the name of the metric to
use in the |
metric_fn |
The vector version of your custom metric function. It
generally takes |
data |
The data frame with |
truth |
The unquoted column name corresponding to the |
estimate |
Generally, the unquoted column name corresponding to
the |
estimator |
For numeric metrics, this is left as |
na_rm |
A |
event_level |
For numeric metrics, this is left as |
... |
Currently not used. Metric specific options are passed in
through |
metric_fn_options |
A named list of metric specific options. These
are spliced into the metric function call using |
metric_summarizer()
is generally called from the data frame version
of your metric function. It knows how to call your metric over grouped data
frames and returns a tibble
consistent with other metrics.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.