pyhealth

Develop and deploy healthcare machine learning models with PyTorch.

3|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/RamanEbrahimi/raman-marketplace --skill pyhealth-ramanebrahimi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pyhealth
Source: https://github.com/RamanEbrahimi/raman-marketplace/tree/main/plugins/agentic-research/skills/scientific-skills/pyhealth
Command: npx skills add https://github.com/RamanEbrahimi/raman-marketplace --skill pyhealth-ramanebrahimi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyhealth-datasets, pyhealth-models, pyhealth-trainer, pytorch, numpy, pandas, scikit-learn, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

PyHealth solves the problem of developing, testing, and deploying machine learning models with clinical data, simplifying healthcare AI research and application.

Core Features & Use Cases

  • Comprehensive Datasets: Access to MIMIC-III/IV, eICU, OMOP, and more healthcare datasets for research.
  • Predictive Models: Implement deep learning models for healthcare applications, such as mortality prediction, drug recommendation, and readmission risk.
  • Custom Task Definition: Create custom tasks for prediction objectives with defined input/output schemas.
  • Model Selection: Choose from baselines, deep learning models, and healthcare-specific models for clinical tasks.
  • Training and Evaluation: Efficient training and evaluation with built-in tools and metrics.

Quick Start

Run the following command to start predicting patient mortality using PyHealth:

from pyhealth.datasets import MIMIC4Dataset
from pyhealth.tasks import mortality_prediction_mimic4_fn
from pyhealth.models import Transformer
from pyhealth.trainer import Trainer

dataset = MIMIC4Dataset(root="/path/to/data")
sample_dataset = dataset.set_task(mortality_prediction_mimic4_fn)

train, val, test = split_by_patient(sample_dataset, [0.7, 0.1, 0.2])
train_loader = get_dataloader(train, batch_size=64, shuffle=True)
val_loader = get_dataloader(val, batch_size=64, shuffle=False)
test_loader = get_dataloader(test, batch_size=64, shuffle=False)

model = Transformer(
    dataset=sample_dataset,
    feature_keys=["diagnoses", "medications"],
    mode="binary",
    embedding_dim=128
)

trainer = Trainer(model=model, device="cuda")
trainer.train(
    train_dataloader=train_loader,
    val_dataloader=val_loader,
    epochs=50,
    monitor="pr_auc_score"
)

results = trainer.evaluate(test_loader)
print(results)

Frequently Asked Questions about pyhealth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I predict patient mortality using MIMIC-IV clinical data in Python?

To predict patient mortality, load MIMIC-IV clinical data in Python, set the mortality prediction task, train a Transformer model using PyTorch, and evaluate performance with built-in metrics like PR-AUC.

Can I build a readmission risk model with deep learning using eICU datasets?

Yes, you can build a readmission risk model by accessing eICU datasets, defining custom prediction tasks with specific input and output schemas, and selecting healthcare-specific deep learning models for training and evaluation.

Do I need PyTorch and scikit-learn to develop healthcare machine learning models?

Yes, developing healthcare machine learning models requires PyTorch for deep learning training, along with NumPy, pandas, and scikit-learn, plus specific libraries like pyhealth-datasets, pyhealth-models, and pyhealth-trainer.

What's the best way to define custom clinical prediction tasks for drug recommendation?

The best way to define custom drug recommendation tasks is by creating custom prediction objectives with defined input and output schemas, then selecting appropriate baseline or healthcare-specific deep learning models to train and evaluate them.

Does PyHealth support OMOP datasets for healthcare AI applications?

Yes, PyHealth supports OMOP datasets alongside MIMIC-III, MIMIC-IV, and eICU, providing comprehensive access to clinical data for developing and deploying machine learning models in healthcare AI research.