Skip to contents

Native implementation of multi-class recall (a.k.a. sensitivity). Per-class recall is TP / (TP + FN); the four estimators behave as for metric_precision().

Usage

metric_recall(
  truth,
  estimate,
  estimator = c("binary", "macro", "macro_weighted", "micro"),
  event_level = c("first", "second")
)

Arguments

truth

Factor (or coercible) of true class labels.

estimate

Factor (or coercible) of predicted class labels. Must take values from the same level set as truth.

estimator

One of "binary" (exactly two classes; uses event_level), "macro" (unweighted mean of per-class precisions), "macro_weighted" (mean weighted by truth-class prevalence), or "micro" (pooled TP and FP across all classes; for single-label multi-class data this equals accuracy).

event_level

For estimator = "binary": which level is the positive event, "first" (default) or "second".

Value

A single numeric value.

References

Sokolova, M., & Lapalme, G. (2009). A systematic analysis of performance measures for classification tasks. Information Processing & Management, 45(4), 427-437. doi:10.1016/j.ipm.2009.03.002

Manning, C. D., Raghavan, P., & Schutze, H. (2008). Introduction to Information Retrieval, Chapter 13. Cambridge University Press. (Free online: https://nlp.stanford.edu/IR-book/)