Tutorials#
We provide the following tutorials to help users get started with our pyhealth. Please bear with us as we update the documentation on how to use pyhealth 2.0.
Tutorial 0: Introduction to pyhealth.data [Video]
Tutorial 1: Introduction to pyhealth.datasets [Video (PyHealth 1.16)]
Tutorial 2: Introduction to pyhealth.tasks [Video (PyHealth 1.16)]
Tutorial 3: Introduction to pyhealth.models [Video]
Tutorial 4: Introduction to pyhealth.trainer [Video]
Tutorial 5: Introduction to pyhealth.metrics [Video]
Data Access Guide#
For information on how to access and download the datasets supported by PyHealth, please refer to our Datasets Overview Notebook.
Additionally, for detailed tutorials on accessing PhysioNet and MIMIC datasets, see the Getting MIMIC access section of the DL4H course instructions.
Pipeline 1: Chest Xray Classification
Pipeline 3: Medical Transcription Classification
Additional Examples#
Warning
Compatibility Notice: Not all examples below have been updated to PyHealth 2.0. However, they remain useful references for understanding workflows and implementation patterns. If you encounter compatibility issues, please refer to the tutorials above or consult the updated API documentation.
The examples/ directory contains additional code examples demonstrating various tasks, models, and techniques. These examples show how to use PyHealth in real-world scenarios.
Browse all examples online: https://github.com/sunlabuiuc/PyHealth/tree/master/examples
Mortality Prediction#
These examples are located in examples/mortality_prediction/.
Example File |
Description |
|---|---|
|
RNN for mortality prediction on MIMIC-III |
|
StageNet for mortality prediction on MIMIC-III |
|
AdaCare for mortality prediction on MIMIC-III (notebook) |
|
Agent model for mortality prediction on MIMIC-III |
|
ConCare for mortality prediction on MIMIC-III |
|
GRASP for mortality prediction on MIMIC-III |
|
Temporal Convolutional Network for mortality prediction |
|
StageNet for mortality prediction on MIMIC-IV (v2) |
|
Time series analysis on MIMIC-IV |
Readmission Prediction#
These examples are located in examples/readmission/.
Survival Prediction#
Example File |
Description |
|---|---|
|
Survival probability prediction preprocessing with SUPPORT2 dataset. Demonstrates feature extraction (demographics, vitals, labs, scores, comorbidities) and ground truth survival probability labels for 2-month and 6-month horizons. Shows how to decode processed tensors back to human-readable features. |
Drug Recommendation#
These examples are located in examples/drug_recommendation/.
Example File |
Description |
|---|---|
|
SafeDrug for drug recommendation on MIMIC-III |
|
MoleRec for drug recommendation on MIMIC-III |
|
GAMENet for drug recommendation on MIMIC-III |
|
Transformer for drug recommendation on MIMIC-III |
|
MICRON for drug recommendation on MIMIC-III |
|
GAMENet for drug recommendation on MIMIC-IV |
|
RETAIN for drug recommendation on MIMIC-IV |
|
Transformer for drug recommendation on eICU |
EEG and Sleep Analysis#
Example File |
Description |
|---|---|
|
ContraWR for sleep staging on SleepEDF |
|
ContraWR for sleep staging on SHHS |
|
SparcNet for sleep staging on ISRUC |
|
SparcNet for EEG event detection |
|
SparcNet for EEG abnormality detection |
|
SparcNet for cardiology arrhythmia detection |
Image Analysis (Chest X-Ray)#
These examples are located in examples/cxr/.
Example File |
Description |
|---|---|
|
ViT training, conformal prediction & interpretability for COVID-19 CXR |
|
Conformal prediction for COVID-19 CXR classification |
|
CNN for chest X-ray classification (notebook) |
|
Binary classification on ChestX-ray14 dataset (notebook) |
|
Multi-label classification on ChestX-ray14 dataset (notebook) |
|
Chest X-ray classification with saliency maps (notebook) |
|
VAE for chest X-ray image generation |
|
GAN for chest X-ray image generation (notebook) |
Interpretability#
These examples are located in examples/interpretability/.
Example File |
Description |
|---|---|
|
Integrated Gradients for StageNet interpretability |
|
DeepLift attributions for StageNet on MIMIC-IV |
|
GIM attributions for StageNet on MIMIC-IV |
|
GIM attributions for Transformer on MIMIC-IV |
|
SHAP attributions for StageNet on MIMIC-IV |
|
Evaluating attribution methods with metrics |
|
Interactive interpretability demonstrations (notebook) |
|
SHAP attributions for StageNet (notebook) |
Patient Linkage#
Example File |
Description |
|---|---|
|
MedLink for patient record linkage on MIMIC-III |
Length of Stay#
These examples are located in examples/length_of_stay/.
Example File |
Description |
|---|---|
|
RNN for length of stay prediction on MIMIC-III |
|
RNN for length of stay prediction on MIMIC-IV |
Advanced Topics#
Example File |
Description |
|---|---|
|
Working with OMOP Common Data Model |
|
Medical code vocabulary and mappings |
|
EHRShot benchmark with XGBoost (notebook) |
Notebooks (Interactive)#
Notebook File |
Description |
|---|---|
|
Comprehensive StageNet tutorial |
|
Cached mortality prediction workflow |
|
Time series analysis on MIMIC-IV |
|
Transformer models on MIMIC-IV |
|
CNN models on MIMIC-IV |
|
Graph Attention Networks on MIMIC-IV |
|
Graph Convolutional Networks on MIMIC-IV |
|
SafeDrug interactive notebook |
|
MoleRec interactive notebook |
|
MICRON interactive notebook |
|
Knowledge graph embeddings |
|
Language model embeddings with HuggingFace |
|
Language model embeddings with OpenAI |
|
Data preprocessing and mapping utilities |
|
Using Torchvision models with graph data |