Waypoint: adaptive change-point detection with autoencoder and CUSUM
Source:R/hcp_waypoint.R
hcp_waypoint.RdImplements the adaptive change-point detector described in the associated SBBD article: a non-supervised autoencoder learns a reference regime from temporal windows, the reconstruction error is standardized on a recent buffer, and a bilateral CUSUM supervisor validates persistent deviations. When a change is confirmed, the model is retrained on recent data and the supervisor is reset.
Usage
hcp_waypoint(
input_size,
encode_size,
warmup = 500,
retrain_size = 300,
buffer_size = 100,
k_factor = 0.35,
h_low = 3.5,
h_high = 6,
prob_tau = 0.997,
epochs_init = 40,
epochs_retrain = 20,
encoderclass = autoenc_base_ed,
...
)Arguments
- input_size
Integer. Window size used to build autoencoder samples.
- encode_size
Integer. Latent size for the autoencoder.
- warmup
Integer. Number of leading observations used to initialize the model.
- retrain_size
Integer. Number of recent observations used when retraining after a confirmed change.
- buffer_size
Integer. Number of previous residuals used to standardize the current reconstruction error.
- k_factor
Numeric. CUSUM reference value (
k).- h_low
Numeric. Warning threshold for the bilateral CUSUM supervisor.
- h_high
Numeric. Confirmation threshold for the bilateral CUSUM supervisor.
- prob_tau
Numeric. Quantile used to estimate the residual threshold from the warm-up regime.
- epochs_init
Integer. Epochs for the initial autoencoder training.
- epochs_retrain
Integer. Epochs for retraining after a confirmed change.
- encoderclass
DALToolbox autoencoder constructor. Defaults to
autoenc_base_ed.- ...
Additional arguments forwarded to
encoderclass; these are the autoencoder-specific parameters, nothcp_waypointparameters.
Details
The method separates representation and decision:
the autoencoder reconstructs windows and produces a scalar reconstruction error;
the error is standardized with a rolling buffer;
a bilateral CUSUM with lower and upper thresholds (
h_low,h_high) acts as the statistical supervisor;after confirmation, the autoencoder is retrained on the most recent regime.
This detector is intended for regime-change monitoring rather than isolated anomaly marking.
References
Ogasawara, E., Salles, R., Porto, F., Pacitti, E. (2025). Event Detection in Time Series.
Salles, R. et al. (2020). Harbinger: Um framework para integração e análise de métodos de detecção de eventos em séries temporais. SBBD.
Ygorra, B. et al. (2021). Monitoring loss of tropical forest cover from Sentinel-1 time-series: A CuSum-based approach.
Ygorra, B. et al. (2024). A near-real-time tropical deforestation monitoring algorithm based on the CuSum change detection method.
De Ryck, T. et al. (2021). Change Point Detection in Time Series Data Using Autoencoders with a Time-Invariant Representation.
Cao, Z. et al. (2024). Change Point Detection in Multi-Channel Time Series via a Time-Invariant Representation.
Corizzo, R. et al. (2022). CPDGA: Change point driven growing auto-encoder for lifelong anomaly detection.
Examples
library(daltoolbox)
data(examples_changepoints)
dataset <- examples_changepoints$simple
model <- hcp_waypoint(input_size = 12, encode_size = 4)
model <- fit(model, dataset$serie)
detection <- detect(model, dataset$serie)
#> Warning: number of items to replace is not a multiple of replacement length
print(detection[detection$event, ])
#> [1] idx event type
#> <0 rows> (or 0-length row.names)