Skip to contents

Returns Accuracy, Recall, Precision, and F1 scores for a binary reference variable and a binary prediction variable.

Usage

get_ARPF(reference, prediction)

Arguments

reference

A binary reference vector.

prediction

A binary prediction vector.

Value

A data.frame with columns 'accuracy', 'recall', 'precision', and 'F1'.

Details

The values of reference and prediction must be 0 or 1. Both variables can be stored in a data.frame or as vectors of equal length. Can be of type numeric or factor.

Examples

mtcars$pred <- get_prediction(mtcars, mtcars$am, mtcars$drat)
get_ARPF(mtcars$am, mtcars$pred)
#>   accuracy    recall precision        F1
#> 1  0.84375 0.8461538 0.7857143 0.8148148