Skip to contents

Usage

flag_top_anomalies(data_with_scores, threshold = NULL, contamination = 0.05)

Arguments

data_with_scores

A data frame containing an anomaly_score column, typically the output of score_anomaly().

threshold

Numeric value between 0 and 1. Records with anomaly_score >= threshold are flagged as anomalous. If NULL (default), uses the contamination rate from the score_anomaly() attributes.

contamination

Numeric value between 0 and 1. If threshold is NULL, this proportion of records with the highest scores will be flagged. Default is 0.05 (5

The input data frame with an additional is_anomaly logical column indicating whether each record is flagged as anomalous. Categorizes records as anomalous or normal based on their anomaly scores, using either a fixed threshold or a contamination rate.