tsseg.algorithms.kcpd package
KCPD — Kernel Change Point Detection.
Description
KCPD operates in a Reproducing Kernel Hilbert Space (RKHS) and detects mean-shifts in the mapped signal. The time series is implicitly mapped by a kernel function \(k(\cdot,\cdot)\) and the algorithm minimises:
When the number of changes K is known, the exact minimum is found by dynamic programming; otherwise a penalised formulation (PELT) is used.
Available kernels: "linear" (L2 cost), "rbf" (Gaussian), "cosine".
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int / None |
|
Number of change points. |
|
float / None |
|
Penalty for the penalised optimisation. |
|
str |
|
Kernel to use ( |
|
int |
|
Minimum segment length. |
|
int |
|
Sub-sampling factor for candidates. |
|
dict / None |
|
Extra arguments for the kernel cost. |
|
int |
|
Time axis. |
Usage
from tsseg.algorithms import KCPDDetector
detector = KCPDDetector(kernel="rbf", n_cps=3)
labels = detector.fit_predict(X)
# Unknown K — use a penalty
detector = KCPDDetector(kernel="rbf", pen=10)
labels = detector.fit_predict(X)
Implementation: Vendored from ruptures v1.1.8 (C implementation). BSD 2-Clause.
Reference: Celisse, Marot, Pierre-Jean & Rigaill (2018), Computational Statistics and Data Analysis; Arlot, Celisse & Harchaoui (2019), JMLR.