Implementation of deep learning–based changepoint detection algorithm designed for time series with smooth local fluctuations. The method fits localized feed‑forward neural networks to approximate the underlying smooth component and constructs a residual‑based detector that isolates abrupt structural changes. A fully data‑adaptive empirical cumulative distribution function (ECDF) based thresholding rule and refinement procedures yield accurate changepoint localization without parametric assumptions on noise or trend structure.
scanCP provides a fast, robust, and fully automated changepoint detection
pipeline based on rolling multilayer perceptron (MLP) models. The method
combines local and global structure learning, RSS-based detector statistics,
ECDF thresholding, and local refinement to identify structural breaks in
univariate signals.
The package is designed for signals with abrupt level shifts, smooth trends, and heterogeneous noise. It includes tools for detector construction, changepoint extraction, signal correction, and visualization.
w and 2w)install.packages("scanCP")
# install.packages("devtools")
devtools::install_github("armanazizyan/scanCP")
library(scanCP)
# Simulate a simple piecewise-constant signal
set.seed(123)
y <- c(
rnorm(200, 0, 1),
rnorm(200, 3, 1),
rnorm(200, -2, 1),
rnorm(200, 1, 1)
)
# Run the full changepoint pipeline
res <- scan_cp(y, w = 100)
# Extract changepoints
res$changepoints
# Plot the corrected signal
plot(y, type = "l", col = "gray70")
lines(res$corrected_signal, col = "blue", lwd = 2)
abline(v = res$changepoints, col = "red", lwd = 2)
scanCP detects changepoints using a hybrid detector statistic derived from
rolling MLP fits:
w) models local structure.2w) models broader structure.The detector is smoothed, thresholded using the ECDF or spacing-curve analysis, and refined using a local k-means split. The result is a set of precise changepoint locations and a corrected signal.
All MLP hyperparameters can be controlled via mlp_control:
res <- scan_cp(
y,
w = 100,
mlp_control = list(
hl1 = 10,
hl2 = 20,
ep1 = 1500,
act1 = "Act_Tanh"
)
)
Full function documentation is available via:
help(package = "scanCP")
GPL-2 License © Arman Azizyan
Issues and pull requests are welcome at: