Skip to content

Update the tutorial series to the PyHealth 2.1 Colab notebooks - #1312

Merged
jhnwu3 merged 2 commits into
sunlabuiuc:masterfrom
solarsys:docs/tutorial-notebooks-2.1
Oct 19, 2026
Merged

jhnwu3 merged 2 commits into
sunlabuiuc:masterfrom
solarsys:docs/tutorial-notebooks-2.1

Conversation

@solarsys

Copy link
Copy Markdown
Collaborator

Summary

examples/tutorials/series still held the pre-release notebooks from #1281: they install PyHealth from GitHub and miss the fixes made since. This replaces them with the maintained Colab versions (the ones linked from pyhealth.dev and, after #1311, from the docs).

What changes:

  • 00–08 replaced with the current Colab notebooks. These versions:
    • install pyhealth==2.1.0 from PyPI;
    • fix the label leaks found in review (Quickstart split after set_task, Tutorial 02 long-stay task);
    • describe the MIMIC mortality target accurately (death in hospital during the next admission);
    • embed a visual guide in each notebook and add a "Try it yourself" section.
  • Tutorials 04 and 07 expanded, and both open on a free T4 GPU, with smaller fallback settings on CPU:
    • 04: all six models (LogisticRegression, MLP, RNN, Transformer, RETAIN, XGBoost) on one patient split, with each model's name on its training-log lines, commented code, and a guide to reading the log and results.
    • 07: label distributions for specialties and ICD codes, an explanation of the "UNEXPECTED weights" load report, and worked examples of correct predictions checked against simple baselines.
  • Three new notebooks, whats_new_1/2/3_*.ipynb, cover splits and reproducibility, calibration and confidence intervals, and XGBoost and code mapping.
  • README.md rewritten for the 12 notebooks.
  • _source/ removed. The notebooks are now edited as notebooks. Running the old generator would overwrite them with the pre-2.1 versions, and nothing else in the repo uses it.

Outputs are kept (about 6 MB in total), so readers can see results on GitHub before running anything. Every notebook comes from a full Colab run with no errors in any cell; 04 and 07 ran on a T4.

Testing

  • All 12 notebooks were run end to end on Colab (Run all). Every code cell executed, and no cell produced an error.
  • Checked the files for credentials and personal paths; the only token mention is Hugging Face's standard "unauthenticated requests" warning.
  • tools/check_pr_rules.py passes.

🤖 Generated with Claude Code

Replace the nine notebooks in examples/tutorials/series with the current
Colab versions, saved with outputs from a full Colab run, and add the
three What's new in 2.1 notebooks. The notebooks now install
pyhealth==2.1.0 from PyPI, fix the label leaks found in review
(Quickstart, Tutorial 02), describe the mortality target as death during
the next admission, embed a visual guide, and add Try it yourself
exercises. Tutorials 04 and 07 open on a T4 GPU and are expanded
(six-model comparison with tagged training logs; label distributions and
checks against baselines for clinical text).

Remove _source/: the notebooks are now edited as notebooks, and running
the old generator would overwrite them with the pre-2.1 versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@solarsys
solarsys requested a review from jhnwu3 October 18, 2026 05:57
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Test Coverage

Total: 67.88% (16694 / 24594 lines)

No modified files under pyhealth/.

Workflow run · 670103b

The Quickstart now predicts in-hospital death of the current admission
(the next-admission task had no signal in the synthetic data) and walks
through a full study: data figures, Table 1, logistic regression, RNN
and XGBoost with bootstrap CIs and calibration, SHAP, subgroups, and an
exported results folder. Outputs are from a full run on a Colab T4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhbzTePoLMBYwjMLG8R9ek
@jhnwu3 jhnwu3 added the status: automatic The PR will go through automatic review process. label Oct 19, 2026
@jhnwu3

jhnwu3 commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

/review

@github-actions github-actions Bot added status: manual Pending maintainer's review and removed status: automatic The PR will go through automatic review process. labels Oct 19, 2026
@github-actions

Copy link
Copy Markdown

AI Review

suggestion: human review
decision: not available

This PR is too large for AI review (over 300 files or 200000 diff characters), so it is labeled status: manual and needs a human review.

@jhnwu3 jhnwu3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jhnwu3
jhnwu3 merged commit 7af8779 into sunlabuiuc:master Oct 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: manual Pending maintainer's review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants