Skip to contents

F1 score from a confusion matrix delegated to hmcfm (hmf1)

Usage

morie_geron_f1_score_alt(y_true, y_pred, pos_label = 1, average = "binary")

Arguments

y_true, y_pred

Labels.

pos_label

Positive class for average="binary".

average

"binary"/"macro"/"micro"/NULL.

Value

List with f1, precision, recall, tp, fp, fn, per_class_f1.

Examples

morie_geron_f1_score_alt(c(0, 0, 1, 1), c(0, 1, 1, 1))
#> $f1
#> [1] 0.8
#> 
#> $precision
#> [1] 0.6666667
#> 
#> $recall
#> [1] 1
#> 
#> $tp
#> [1] 2
#> 
#> $fp
#> [1] 1
#> 
#> $fn
#> [1] 0
#> 
#> $per_class_f1
#> [1] 0.6666667 0.8000000
#> 
#> $labels
#> [1] 0 1
#> 
#> $average
#> [1] "binary"
#> 
#> $estimate
#> [1] 0.8
#> 
#> $n
#> [1] 4
#> 
#> $method
#> [1] "F1 = 2PR/(P+R) from a confusion matrix delegated to hmcfm"
#>