mtslearn: Machine Learning in Python for Medical Time Series
Authors: Zhongheng Jiang, Yuechao Zhao, Donglin Xie, Chenxi Sun, Rongchen Lu, Silu Luo, Zisheng Liang, Shenda Hong
Organizations: Nanjing University of Information Science and Technology, Nanjing, China · National Institute of Health Data Science, Peking University, Beijing, China · School of Health Humanities, Peking University Health Science Center, Beijing, China · Institute of Medical Technology, Peking University Health Science Center, Beijing, China · Harvard Medical School, Boston, US · Beth Israel Deaconess Medical Center, Boston, US · School of Business English, Sichuan International Studies University, Chongqing, China · School of Clinical Medicine, Chengdu Medical College, Chengdu, Sichuan, China · Institute for Artificial Intelligence, Peking University, Beijing, China · State Key Laboratory of Vascular Homeostasis and Remodeling, NHC Key Laboratory of Cardiovascular Molecular Biology and Regulatory Peptides, Peking University, Beijing, China
Medical time-series data captures the dynamic progression of patient conditions, playing a vital role in modern clinical decision support systems. However, real-world clinical data is highly heterogeneous and inconsistently formatted. Furthermore, existing machine learning tools often have steep learning curves and fragmented workflows. Consequently, a significant gap remains between cutting-edge AI technologies and clinical application. To address this, we introduce mtslearn, an end-to-end integrated toolkit specifically designed for medical time-series data. First, the framework provides a unified data interface that automates the parsing and alignment of wide, long, and flat data formats. This design significantly reduces data cleaning overhead. Building on this, mtslearn provides a complete pipeline from data reading and feature engineering to model training and result visualization. Furthermore, it offers flexible interfaces for custom algorithms. Through a modular design, mtslearn simplifies complex data engineering tasks into a few lines of code. This significantly lowers the barrier to entry for clinicians with limited programming experience, empowering them to focus more on exploring medical hypotheses and accelerating the translation of advanced algorithms into real-world clinical practice. mtslearn is publicly available at https://github.com/PKUDigitalHealth/mtslearn.
Figures & tables
Figure 1: Evolutionary paradigm of clinical prediction modeling. Rather than introducing complex deep learning algorithms for time-series data, this study builds upon traditional statistical methods and classic deep learning algorithms. We integrated established AI medical tools into a unified framework to simplify workflows for clinicians.
Figure 2: Structural representations of heterogeneous clinical data. The schematic illustrates the three most common tabular formats encountered in clinical records: Wide format, Long format, and Flattened format. mtslearn standardizes these diverse inputs into a unified representation to significantly reduce manual preprocessing overhead.
Name
Preprocessing
Predict
End-to-End
Data cleaning
Time-series resampling
Feature Stats
Static model
Time-series model
Pipelining
TemporAI 19
✓
×
×
✓
✓
✓
Clairvoyance 8
✓
✓
×
✓
✓
✓
NeuroKit2 14
✓
✓
✓
×
×
×
Talent 12
✓
×
×
✓
×
✓
scikit-learn 17
✓
×
×
✓
×
✓
Table 1: Functional comparison of existing machine learning toolkits versus mtslearn. The table highlights capabilities across data preprocessing and model prediction, which shows that most existing toolkits focus on specific stages. ("End-to-End Pipeline" denotes a unified workflow integrating the entire lifecycle, from raw data processing to model evaluation.)
School of Computer Science, McGill University, Montreal, Canada · Mila – Quebec AI Institute, Montreal, Canada · Centre intégré universitaire de santé et de services sociaux de l’Estrie – Centre hospitalier universitaire de Sherbrooke (CIUSSSE-CHUS), Sherbrooke, Canada +2