Compute the F1 Score of multi-class problem using the "micro" average. details: https://sebastianraschka.com/faq/docs/multiclass-metric.html

F1_Score_micro(y_true, y_pred, labels = NULL)

Arguments

y_true

Ground truth (correct) labels vector

y_pred

Predicted labels vector, as returned by a classifier

labels

An optional vector containing the list of the existent (unique) labels.

Value

F1 Score (micro averaged)

Examples

labels <- c("Q1", "Q2", "Q3", "Q4")
truth <- sample(labels, 10, replace = TRUE)
pred <- sample(labels, 10, replace = TRUE)
F1_Score_micro(y_pred = pred, y_true = truth, labels)
#> [1] 0.2