Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (23 sloc) 1.22 KB

Simple Sequence Segmenting

This repository contains Python code I wrote for segmenting 1-D time series. In other words, it can be used for transforming a time series into a piecewise linear represenation. The algorithms are Python implementations of the "classical" algorithms, as described in An Online Algorithm for Segmenting Time Series, including:

  • the sliding window algorithm;
  • the top-down algorithm; and
  • the bottom-up algorithm.

The code is not optimized for performance in any way, but I've found it useful for experimenting and data exploration.


The segmenting algorithms use NumPy's least squares fitting routine, so naturally it depends on NumPy.


You can run the code to see example output by running the script. The script requires matplotlib to display the plots.

The example uses ECG data I found on an ECG data site.