Piecewise linear representation of 1D data in Python
Python
Switch branches/tags
Nothing to show
Latest commit 40d2f2a Feb 27, 2012 @NickFoubert Another README fix
Permalink
Failed to load latest commit information.
example_data Initial import Feb 27, 2012
README.md
example.py Initial import Feb 27, 2012
fit.py Initial import Feb 27, 2012
segment.py Initial import Feb 27, 2012
wrappers.py

README.md

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.

Requirements

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

Example

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

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