Skip to contents

The documentation covers the three parts of every detection: the cost function, the segmentation method and model selection. This page lists the basic functions and shows how the package is organised; the sidebar links to each part.

Basic functions

Every segmentation class (binSeg, Window, PELT and Dynp) has the same methods, so code written for one runs with the others.

Function What it does
costFunc$new() Chooses the cost function, which sets the kind of change to look for.
binSeg$new(), Window$new(), PELT$new(), Dynp$new() Chooses the segmentation method, which searches for the change-points.
$fit(tsMat) Attaches the time series: a matrix with one row per time point.
$predict(pen = ...) Returns the change-points for a penalty per change-point.
$predict(nBkps = ...) Returns the change-points for a given number of change-points.
$plot() Plots the series with the detected segments.
$segments() Gives the cost and parameter estimates of each segment.
$eval(a, b) Gives the cost of the segment (a, b].

How the package is organised

A detection with K change-points t_1 < \dots < t_K, where t_0 = 0 and t_{K+1} = n, minimises the total cost of the segments plus a penalty \lambda per change-point:

\sum_{k=0}^{K} c\left(y_{(t_k+1):t_{k+1}}\right) + \lambda K.

The cost function sets c, the segmentation method searches over the change-points, and model selection sets \lambda, or fixes K instead. The package follows the same split.

rupturesRcpp
  • Cost functions

    What kind of change to look for

    • costFunc$new(): "L1", "L2", "SIGMA", "VAR", "LinearL2", "LinearSIGMA", "LinearL1", "Custom"
    • costFactory: costs without a detection
  • Segmentation methods

    How to search for change-points

    • binSeg: binary segmentation
    • Window: sliding window
    • PELT: exact for a penalty
    • Dynp: exact for a number of change-points
  • Model selection

    How many change-points to keep

    • $predict(pen = ...): a penalty per change-point
    • $predict(nBkps = ...): a fixed number
    • $getHistory() and $plotElbow(): the elbow method