PyHealth icon indicating copy to clipboard operation
PyHealth copied to clipboard

Add LabTop usecase for PyHealth

Open anishsao opened this issue 1 month ago • 0 comments

Contributors:
Anish Sao (sao3), Kristopher Iotov (kiotov2)

Contribution type:
New example / use case of PyHealth.

High-level description:
This PR adds an example script examples/labtop_example/labtop_demo.py which demonstrates the Lab Test Outcome Prediction (LabTOP) architecture using a GPT-2 model. The example showcases three key methods from the LabTOP paper: digit-wise tokenization of continuous lab values, lab-aware vocabulary with special tokens for demographics and lab item identifiers, and autoregressive forecasting of lab measurements.

How to run From the PyHealth repo root, run: python examples/labtop_example/labtop_demo.py The script will generate 100 synthetic patients with creatinine measurements, then train a small GPT-2 model for 3 epochs on 80 training samples while displaying training progress with loss values. After training, it generates autoregressive predictions on 10 test samples and reports the final Mean Absolute Error on the test set. The output includes example predictions compared with actual values for the first 3 test samples.

anishsao avatar Dec 05 '25 06:12 anishsao