Developer function for calling new metrics
metric_vec_template()
is useful alongside metric_summarizer()
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.
metric_vec_template( metric_impl, truth, estimate, na_rm = TRUE, cls = "numeric", estimator = NULL, ... )
metric_impl |
The core implementation function of your custom metric. This core implementation function is generally defined inside the vector method of your metric function. |
truth |
The realized vector of |
estimate |
The realized |
na_rm |
A |
cls |
A character vector of length 1 or 2 corresponding to the
class that |
estimator |
The type of averaging to use. By this point, the averaging
type should be finalized, so this should be a character vector of length 1\.
By default, this character value is required to be one of: |
... |
Extra arguments to your core metric function, |
metric_vec_template()
is called from the vector implementation of your
metric. Also defined inside your vector implementation is a separate
function performing the core implementation of the metric function. This
core function is passed along to metric_vec_template()
as metric_impl
.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.