Skip to contents

Extracts benchmarking metrics from a data frame that was scored with score_anomaly() using ground truth labels.

Usage

extract_benchmark_metrics(scored_data)

Arguments

scored_data

A data frame with anomaly scores, typically the output of score_anomaly() with a ground_truth_col specified.

Value

A list containing benchmarking metrics, or NULL if no metrics are available.

Examples

# \donttest{
data <- data.frame(
  patient_id = 1:50,
  age = rnorm(50, 50, 15),
  is_error = sample(c(0, 1), 50, replace = TRUE, prob = c(0.95, 0.05))
)
scored_data <- score_anomaly(data, ground_truth_col = "is_error")
metrics <- extract_benchmark_metrics(scored_data)
print(metrics$auc_roc)
#> [1] 0.4375
# }