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

f1

F1 Score


Description

f1 computes the F1 Score in the context of information retrieval problems.

Usage

f1(actual, predicted)

Arguments

actual

The ground truth vector of relevant documents. The vector can contain any numeric or character values, order does not matter, and the vector does not need to be the same length as predicted.

predicted

The predicted vector of retrieved documents. The vector can contain any numeric or character values, order does not matter, and the vector does not need to be the same length as actual.

Details

f1 is defined as 2 * precision * recall / (precision + recall). In the context of information retrieval problems, precision is the proportion of retrieved documents that are relevant to a query and recall is the proportion of relevant documents that are successfully retrieved by a query. If there are zero relevant documents that are retrieved, zero relevant documents, or zero predicted documents, f1 is defined as 0.

See Also

Examples

actual <- c('a', 'c', 'd')
predicted <- c('d', 'e')
f1(actual, predicted)

Metrics

Evaluation Metrics for Machine Learning

v0.1.4
BSD_3_clause + file LICENSE
Authors
Ben Hamner [aut, cph], Michael Frasco [aut, cre], Erin LeDell [ctb]
Initial release

We don't support your browser anymore

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