Learn R Programming

measures (version 0.3)

F1: F1 measure

Description

Defined as: 2 * tp/ (sum(truth == positive) + sum(response == positive))

Usage

F1(truth, response, positive)

Arguments

truth

vector of true values

response

vector of predicted values

positive

positive class

Examples

Run this code
# NOT RUN {
n = 20
set.seed(125)
truth = as.factor(sample(c(1,0), n, replace = TRUE))
probabilities = runif(n)
response = as.factor(as.numeric(probabilities > 0.5))
positive = 1
F1(truth, response, positive)
# }

Run the code above in your browser using DataLab