Table of Contents
Fetching ...

PyHealth 2.0: A Comprehensive Open-Source Toolkit for Accessible and Reproducible Clinical Deep Learning

John Wu, Yongda Fan, Zhenbang Wu, Paul Landes, Eric Schrock, Sayeed Sajjad Razin, Arjun Chatterjee, Naveen Baskaran, Joshua Steier, Andrea Fitzpatrick, Bilal Arif, Rian Atri, Jathurshan Pradeepkumar, Siddhartha Laghuvarapu, Junyi Gao, Adam R. Cross, Jimeng Sun

TL;DR

PyHealth 2.0 addresses reproducibility and accessibility barriers in clinical deep learning by unifying data handling, modeling, and evaluation for multimodal healthcare data within a single open-source toolkit. It delivers memory-efficient, end-to-end pipelines spanning data, processing, tasks, models, and metrics, with built-in interpretability and uncertainty quantification. The framework scales from laptops to clusters, enabling rapid reproduction and exploration of clinical AI pipelines while supporting diverse data modalities and coding standards. By fostering an active community and providing extensive documentation and tutorials, PyHealth 2.0 aims to democratize reproducible, responsible healthcare AI research and deployment.

Abstract

Difficulty replicating baselines, high computational costs, and required domain expertise create persistent barriers to clinical AI research. To address these challenges, we introduce PyHealth 2.0, an enhanced clinical deep learning toolkit that enables predictive modeling in as few as 7 lines of code. PyHealth 2.0 offers three key contributions: (1) a comprehensive toolkit addressing reproducibility and compatibility challenges by unifying 15+ datasets, 20+ clinical tasks, 25+ models, 5+ interpretability methods, and uncertainty quantification including conformal prediction within a single framework that supports diverse clinical data modalities - signals, imaging, and electronic health records - with translation of 5+ medical coding standards; (2) accessibility-focused design accommodating multimodal data and diverse computational resources with up to 39x faster processing and 20x lower memory usage, enabling work from 16GB laptops to production systems; and (3) an active open-source community of 400+ members lowering domain expertise barriers through extensive documentation, reproducible research contributions, and collaborations with academic health systems and industry partners, including multi-language support via RHealth. PyHealth 2.0 establishes an open-source foundation and community advancing accessible, reproducible healthcare AI. Available at pip install pyhealth.

PyHealth 2.0: A Comprehensive Open-Source Toolkit for Accessible and Reproducible Clinical Deep Learning

TL;DR

PyHealth 2.0 addresses reproducibility and accessibility barriers in clinical deep learning by unifying data handling, modeling, and evaluation for multimodal healthcare data within a single open-source toolkit. It delivers memory-efficient, end-to-end pipelines spanning data, processing, tasks, models, and metrics, with built-in interpretability and uncertainty quantification. The framework scales from laptops to clusters, enabling rapid reproduction and exploration of clinical AI pipelines while supporting diverse data modalities and coding standards. By fostering an active community and providing extensive documentation and tutorials, PyHealth 2.0 aims to democratize reproducible, responsible healthcare AI research and deployment.

Abstract

Difficulty replicating baselines, high computational costs, and required domain expertise create persistent barriers to clinical AI research. To address these challenges, we introduce PyHealth 2.0, an enhanced clinical deep learning toolkit that enables predictive modeling in as few as 7 lines of code. PyHealth 2.0 offers three key contributions: (1) a comprehensive toolkit addressing reproducibility and compatibility challenges by unifying 15+ datasets, 20+ clinical tasks, 25+ models, 5+ interpretability methods, and uncertainty quantification including conformal prediction within a single framework that supports diverse clinical data modalities - signals, imaging, and electronic health records - with translation of 5+ medical coding standards; (2) accessibility-focused design accommodating multimodal data and diverse computational resources with up to 39x faster processing and 20x lower memory usage, enabling work from 16GB laptops to production systems; and (3) an active open-source community of 400+ members lowering domain expertise barriers through extensive documentation, reproducible research contributions, and collaborations with academic health systems and industry partners, including multi-language support via RHealth. PyHealth 2.0 establishes an open-source foundation and community advancing accessible, reproducible healthcare AI. Available at pip install pyhealth.
Paper Structure (16 sections, 8 figures, 40 tables)

This paper contains 16 sections, 8 figures, 40 tables.

Figures (8)

  • Figure 1: PyHealth as a comprehensive healthcare AI development toolkit. To tackle the reproducibility crisis in healthcare AI, (a) PyHealth has re-implemented over 10 different datasets for data loading, several dozen tasks, and over 25 different models with a variety of post-hoc model deployment features for better evaluating model performance. By re-implementing many of these components with standardized interfaces, (b) the amount of code required to generate samples ready for training on a specific ML task has been reduced from over 129 lines to fewer than 9. To enable users with limited computational resources, (c) PyHealth contains a variety of backend optimizations that enable data processing on modern laptops and support up to 39× faster processing speeds than alternatives (Figure \ref{['fig:pyhealth_performance']}). Finally, as a growing open-source community, (d) PyHealth 2.0 further embodies reproducible research principles through extensive examples and collaborative development.
  • Figure 2: PyHealth Overview. PyHealth provides a comprehensive end-to-end pipeline for healthcare AI development spanning all aspects of clinical modeling. Starting from (a) standardized data structures (pyhealth.data) and (b) flexible data transformations (pyhealth.processors), we accommodate diverse clinical datasets through (c) memory-efficient lazy-loaded dataset loading (pyhealth.datasets) and (d) optimized task-specific ML processing for creating trainable formats (pyhealth.tasks). The framework supports (e) baseline model benchmarking (pyhealth.models) and (f) comprehensive evaluation metrics for fairness, uncertainty quantification, and interpretability—all critical for clinical deployment (pyhealth.metrics). For post-training utility, we provide g. model interpretation tools (pyhealth.interpret), (h) uncertainty quantification via calibration and conformal prediction (pyhealth.calib), and (i) medical code translation and lookup across hospital coding standards (pyhealth.medcode).
  • Figure 3: PyHealth 2.0 delivers efficient scaling across machines. We benchmark PyHealth 2.0 against PyHealth 1.16 and a Naive pandas approach from reading the raw .csv files in MIMIC-IV johnson2023mimic4 to transforming them all the way into trainable tensor formats here on three different tasks (a) Labevent-based mortality prediction, (b) drug recommendation, and (c) length of stay prediction. The platform achieves up to 39× speedup over naive pandas implementations and remains comparable or even faster than our PyHealth 1.16 predecessor in certain task despite using over 20× less memory. Through memory optimizations via multiworker sharding with Dask rocklin2015dask and Polars nahrstedt2024empirical_polars, PyHealth 2.0 dynamically adapts memory usage to accommodate resource-constrained environments, fitting comfortably within a laptop's 16GB memory limit. Notably, memory consumption remains relatively constant even with access to larger memory pools and increased worker counts. We offer exact numbers in Appendix \ref{['appdx: pyhealth table perf']}.
  • Figure 4: Defining your own PyHealth tasks. (a) Exploring patient data is key to defining your own custom task. (b) Once a task class is defined, PyHealth 2.0's optimized backend can handle the rest of the efficient parallel data processing. The key approach here is that for any new task, only a single class call has to be defined, following the (c) same pipeline for generating each task here.
  • Figure 5: PyHealth 2.0 directly supports loading multimodal data. With effectively only 5 lines of code, PyHealth 2.0 now supports the ability to work with (b) structured EHR codes, (c) biosignals, (d) clinical notes, (e) and X-rays on MIMIC-IV data johnson2023mimic4.
  • ...and 3 more figures