Compute class-wise metrics for a metric set in a multiclass setting
Source:R/course-ML.R
metric_by_event.RdThis function computes class-wise metrics for a metric set in a multiclass setting by binarizing the outcome variable for each class and applying the metric set to each binary version of the data.
Arguments
- data
A data frame containing the columns specified in
truth,estimate, and....- metric_set
A metric set function (e.g.,
yardstick::metric_set()) that includes class-wise metrics.- truth
The column identifier for the true class results (that is a
factor). This should be an unquoted column name although this argument is passed by expression and supports quasiquotation (you can unquote column names). For_vec()functions, afactorvector.- estimate
The column identifier for the predicted class results (that is also
factor). As withtruththis can be specified different ways but the primary method is to use an unquoted variable name. For_vec()functions, afactorvector.- ...
Not currently used.
- .all
A logical value indicating whether to include all metrics from the metric set (including those that do not use macro/micro estimators).
Value
A tibble with the same columns to be expected from the metric set,
plus the following additional columns: .class indicating the class for which
the metric was computed. For these rows, .estimator is set to "event" to
indicate that these are event-level metrics.
See also
Other ML4Psych:
jaccard_avg(),
pred_strength_min()