Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

f1_score

F1 Score


Description

Calculates weighted F1 score or F measure defined as the harmonic mean of precision and recall, see https://en.wikipedia.org/wiki/Precision_and_recall for some background. The higher, the better.

Usage

f1_score(actual, predicted, w = NULL, ...)

Arguments

actual

Observed values (0 or 1).

predicted

Predicted values (0 or 1).

w

Optional case weights.

...

Further arguments passed to precision and recall.

Value

A numeric vector of length one.

See Also

Examples

f1_score(c(0, 0, 1, 1), c(0, 0, 1, 1))
f1_score(c(1, 0, 0, 1), c(0, 0, 1, 1))
f1_score(c(1, 0, 0, 1), c(0, 0, 1, 1), w = 1:4)

MetricsWeighted

Weighted Metrics, Scoring Functions and Performance Measures for Machine Learning

v0.5.2
GPL (>= 2)
Authors
Michael Mayer [aut, cre, cph], Christian Lorentzen [ctb, rev]
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.