This function estimates one or more common performance
estimates depending on the class of truth
(see Value
below) and returns them in a single row tibble.
metrics(data, ...)# S3 method for data.frame
metrics(data, truth, estimate, ..., options = list(),
na.rm = TRUE)
A data frame
For classification: a set of unquoted column names
or one or more dplyr
selector functions to choose which
variables contain the class probabilities. See the examples
below. For roc_auc
and pr_auc
, only one value is required.
If more are given, the functions will try to match the column
name to the appropriate factor level of truth
. If this doesn't
work, an error is thrown. For mnLogLoss
, there should be as
many columns as factor levels of truth
. It is assumed that
they are in the same order as the factor levels.
The column identifier for the true results (that is numeric or factor). This should an unquoted column name although this argument is passed by expression and support quasiquotation (you can unquote column names or column positions).
The column identifier for the predicted results
(that is also numeric or factor). As with truth
this can be
specified different ways but the primary method is to use an
unquoted variable name.
Options to pass to roc()
such as direction
or
smooth
. These options should not include response
,
predictor
, or levels
.
A logical value indicating whether NA
values should be stripped before the computation proceeds.
A single row tibble. When truth
is a factor, there is
an accuracy()
column. If a full set of class probability
columns are passed to ...
, then there is also a column for
mnLogLoss()
. When truth
has two levels and there are class
probabilities, roc_auc()
is appended. When truth
is numeric,
there are columns for rmse()
and rsq()
,
A number or NA