Skip to main content
QUICK REVIEW

[Paper Review] Seglearn: A Python Package for Learning Sequences and Time Series

David Burns, Cari Whyne|arXiv (Cornell University)|Mar 21, 2018
Time Series Analysis and ForecastingComputer Science8 references7 citations
TL;DR

seglearn is a scikit-learn-compatible Python package that enables machine learning on time series and sequential data through sliding window segmentation, feature representation, and integration with classical and deep learning models. It supports classification, regression, and forecasting with multivariate, contextual, and irregularly sampled sequences, achieving high performance and low computation time compared to existing tools.

ABSTRACT

Seglearn is an open-source python package for machine learning time series or sequences using a sliding window segmentation approach. The implementation provides a flexible pipeline for tackling classification, regression, and forecasting problems with multivariate sequence and contextual data. This package is compatible with scikit-learn and is listed under scikit-learn Related Projects. The package depends on numpy, scipy, and scikit-learn. Seglearn is distributed under the BSD 3-Clause License. Documentation includes a detailed API description, user guide, and examples. Unit tests provide a high degree of code coverage.

Motivation & Objective

  • To address the limitations of standard machine learning frameworks in handling sequential data where samples are not independently and identically distributed.
  • To provide a unified, scikit-learn-compatible pipeline for processing multivariate time series and sequences with variable length, irregular sampling, and contextual data.
  • To enable both feature-based learning with classical estimators and direct learning with deep neural networks via segmentation and temporal processing.
  • To support end-to-end model selection and cross-validation along the temporal axis, improving reproducibility and performance evaluation.
  • To outperform existing time series packages in computational efficiency while maintaining or exceeding accuracy on benchmark tasks.

Proposed method

  • Uses sliding window segmentation to convert variable-length sequences into fixed-length segments, enabling use of standard estimators.
  • Applies feature representation via statistical transforms (e.g., mean, standard deviation, skewness) on segmented windows to extract meaningful representations.
  • Supports temporal train-test splits and cross-validation folds that respect the sequential nature of time series data.
  • Integrates with scikit-learn pipelines, allowing seamless use of standard transformers, estimators, and model selection tools.
  • Enables direct learning with deep learning models via Keras integration, supporting sequence-to-sequence and sequence-to-label prediction.
  • Includes interpolation for resampling irregularly sampled time series and supports contextual data as auxiliary features.

Experimental results

Research questions

  • RQ1How can time series and sequential data be effectively preprocessed and represented for use with classical machine learning algorithms?
  • RQ2To what extent can a scikit-learn-compatible pipeline improve usability and interoperability for time series learning tasks?
  • RQ3How does the performance of seglearn compare to other leading time series packages in terms of accuracy and computational efficiency?
  • RQ4Can end-to-end model selection be effectively applied to time series data using temporal cross-validation and segmentation parameters?
  • RQ5What is the impact of feature representation and segmentation parameters on the overall performance of sequence learning models?

Key findings

  • seglearn achieved a classification accuracy of 0.714 on a human activity recognition dataset, matching cesium-ml and tsfresh, and significantly outperforming tslearn (0.057).
  • seglearn demonstrated the fastest computation time (0.088 seconds) among the evaluated packages, outperforming tsfresh (0.40 s), cesium-ml (62.9 s), and tslearn (0.79 s).
  • The package supports end-to-end model selection via scikit-learn’s framework, enabling optimization of segmentation parameters such as window size and overlap.
  • seglearn provides full compatibility with deep learning models through Keras integration, enabling direct sequence learning with CNNs and RNNs.
  • The inclusion of contextual data and support for time series targets enables more complex modeling scenarios not supported by tsfresh or tslearn.
  • The package includes comprehensive documentation, unit tests, and is distributed under the BSD 3-Clause License, ensuring accessibility and maintainability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.