General metrics for two class problems that are not already
in sens()
or recall()
are here, such as the Matthews
correlation coefficient, Youden's J.
There is no common convention on which factor level should
automatically be considered the "event" or "positive" results.
In yardstick
, the default is to use the first level. To
change this, a global option called yardstick.event_first
is
set to TRUE
when the package is loaded. This can be changed
to FALSE
if the last level of the factor is considered the
level of interest.
mcc(data, ...)# S3 method for data.frame
mcc(data, truth, estimate, na.rm = TRUE, ...)
# S3 method for table
mcc(data, ...)
j_index(data, ...)
# S3 method for data.frame
j_index(data, truth, estimate, na.rm = TRUE, ...)
# S3 method for table
j_index(data, ...)
For the default functions, a factor containing the
discrete measurements. For the table
or matrix
functions, a table or matrix object, respectively, where the
true class results should be in the columns of the table.
Not currently used.
The column identifier for the true class results (that is a 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 class
results (that is also factor). As with truth
this can be
specified different ways but the primary method is to use an
unquoted variable name.
A logical value indicating whether NA
values should be stripped before the computation proceeds
If more than one statistic is required, it is more
computationally efficient to create the confusion matrix using
conf_mat()
and applying the corresponding summary
method
(summary.conf_mat()
) to get the values at once.
# NOT RUN {
data("two_class_example")
mcc(two_class_example, truth, predicted)
j_index(two_class_example, truth, predicted)
# }
Run the code above in your browser using DataLab