cm_metrics: Metrics from a confusion matrix

View source: R/metrics.R

cm_metricsR Documentation

Metrics from a confusion matrix

Description

Metrics of a batch from the counts of its confusion matrix, vectorised over batches. A metric whose denominator is zero comes back as NA.

Usage

cm_metrics(TP, FP, TN, FN)

Arguments

TP

True positives, one value per batch.

FP

False positives, one value per batch.

TN

True negatives, one value per batch.

FN

False negatives, one value per batch.

Value

A list with accuracy, precision, recall and f1, one value per batch.

Examples

cm_metrics(TP = 8, FP = 2, TN = 85, FN = 5)

heimdall documentation built on Dec. 2, 2026, 5:08 p.m.