Python module for machine learning time series:
Switch branches/tags
Nothing to show
Clone or download
Latest commit bb71233 Oct 18, 2018


Travis Pypi PythonVersion CircleCI Coveralls


Seglearn is a python package for machine learning time series or sequences. It provides an integrated pipeline for segmentation, feature extraction, feature processing, and final estimator. Seglearn provides a flexible approach to multivariate time series and related contextual (meta) data for classification, regression, and forecasting problems. Support and examples are provided for learning time series with classical machine learning and deep learning models. It is compatible with scikit-learn.


Installation documentation, API documentation, and examples can be found on the documentation.


seglearn is tested to work under Python 2.7 and Python 3.5. The dependency requirements are based on the last scikit-learn release:

  • scipy(>=0.13.3)
  • numpy(>=1.8.2)
  • scikit-learn(>=0.19.0)

Additionally, to run the examples, you need:

  • matplotlib(>=2.0.0)
  • keras (>=2.1.4) for the neural network examples
  • pandas

In order to run the test cases, you need:

  • pytest

The neural network examples were tested on keras using the tensorflow-gpu backend, which is recommended.


seglearn-learn is currently available on the PyPi's repository and you can install it via pip:

pip install -U seglearn

or if you use python3:

pip3 install -U seglearn

If you prefer, you can clone it and run the file. Use the following commands to get a copy from GitHub and install all dependencies:

git clone
cd seglearn
pip install .

Or install using pip and GitHub:

pip install -U git+


After installation, you can use pytest to run the test suite from seglearn's root directory:


Change Log

Version 1.0.2:

  • Added further features

Version 1.0.1:

  • Improvements to documentation, error checking, and unit tests
  • feature_functions min and max changed to minimum and maximum respectively

Version 1.0.0:

  • Major API change integrating preprocessing and estimation into single pipeline (Pype)
  • Note this is unfortunately not backwards compatible
  • Added Interp transformer for resampling time series

Version 0.2.0:

  • Added transformer for segmenting data set with padding and / or truncation
  • Implemented random_state initialization for SegPipe
  • Corrected documentation for FeatureRep

Version 0.1.6:

  • First stable version


The development of this scikit-learn-contrib is in line with the one of the scikit-learn community. Therefore, you can refer to their Development Guide.


This package was developed by:

David M. Burns MD, PhD(c)
Sunnybrook Research Institute
University of Toronto

Citing seglearn

If you use seglearn in a scientific publication, we would appreciate citations to the following paper:

author  = {David Burns, Cari Whyne},
title   = {Seglearn: A Python Package for Learning Sequences and Time Series},
journal = {arXiv},
year    = {2018},
url     = {}

If you use the seglearn test data in a scientific publication, we would appreciate citations to the following paper:

author  = {David Burns, Nathan Leung, Michael Hardisty, Cari Whyne, Patrick Henry, Stewart McLachlin},
title   = {Shoulder Physiotherapy Exercise Recognition: Machine Learning the Inertial Signals from a Smartwatch},
journal = {arXiv},
year    = {2018},
url     = {}