f1_score | R Documentation |
Given the observed and predicted values of categorical data (of any number of classes) computes the F1 score, that combines the precision and recall, and it is defined as the harmonic mean of the precision and recall.
f1_score(observed, predicted, positive_class = NULL, remove_na = TRUE)
observed |
( |
predicted |
( |
positive_class |
( |
remove_na |
( |
F1 score is computed as:
See precision()
and recall()
for more information.
For binary data a single value is returned, for more than 2 categories a vector of F1 scores is returned, one per each category.
Other categorical_metrics:
accuracy()
,
brier_score()
,
categorical_summary()
,
confusion_matrix()
,
kappa_coeff()
,
math_mode()
,
matthews_coeff()
,
pccc()
,
pcic()
,
pr_auc()
,
precision()
,
recall()
,
roc_auc()
,
sensitivity()
,
specificity()
## Not run:
f1_score(factor(c("a", "b")), factor(c("a", "b")))
f1_score(factor(c("a", "b", "a", "b")), factor(c("a", "b", "b", "a")))
f1_score(factor(c("a", "b")), factor(c("b", "b")))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.