Skip to contents

Filters and shifts the anomaly detection results (`proc`) so that they align with the time window of the current batch. Optionally includes some earlier values to compensate for tail-side loss due to moving average smoothing.

Usage

adjust_proc(proc, curr_batch, n_missed)

Arguments

proc

A data frame returned from anomaly detection, including `GPS` and `cluster` columns.

curr_batch

A `ts` object for the current batch, used to define time bounds.

n_missed

A list indicating how many time points to include before the current batch (e.g., `n_missed[["Mt"]]` due to moving average tail loss).

Value

A filtered and adjusted data frame with corrected cluster indices and time span.

Details

Specifically: - Crops `proc` to include only time values within the current batch range (optionally extended backward by `n_missed[["Mt"]]` points). - If anomalies exist, shifts cluster labels to ensure they start from 1.