Skip to content

Commit c63aae4

Browse files
authored
Lime Interpretability (#758)
1 parent 528e27e commit c63aae4

File tree

6 files changed

+2442
-1
lines changed

6 files changed

+2442
-1
lines changed

docs/api/interpret.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ New to interpretability in PyHealth? Check out these complete examples:
5050
- Compare different baseline strategies for background sample generation
5151
- Decode attributions to human-readable medical codes and lab measurements
5252

53+
**LIME Example:**
54+
55+
- ``examples/lime_stagenet_mimic4.py`` - Demonstrates LIME (Local Interpretable Model-agnostic Explanations) for StageNet mortality prediction. Shows how to:
56+
57+
- Compute local linear approximations to explain model predictions
58+
- Generate perturbations around input samples to train interpretable models
59+
- Compare different regularization methods (Lasso vs Ridge) for feature selection
60+
- Test various distance kernels (cosine vs euclidean) and sample sizes
61+
- Decode attributions to human-readable medical codes and lab measurements
62+
5363
These examples provide end-to-end workflows from loading data to interpreting and evaluating attributions.
5464

5565
Available Methods
@@ -64,4 +74,5 @@ Available Methods
6474
interpret/pyhealth.interpret.methods.deeplift
6575
interpret/pyhealth.interpret.methods.integrated_gradients
6676
interpret/pyhealth.interpret.methods.shap
77+
interpret/pyhealth.interpret.methods.lime
6778

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pyhealth.interpret.methods.lime
2+
===============================
3+
4+
Overview
5+
--------
6+
7+
:class:`pyhealth.interpret.methods.lime.LimeExplainer` provides LIME (Local Interpretable Model-agnostic Explanations)
8+
attributions for PyHealth models by approximating the model locally with an interpretable linear model. Consult the class docstring for
9+
detailed guidance, usage notes, and examples. A full workflow is demonstrated in
10+
``examples/lime_stagenet_mimic4.py``.
11+
12+
API Reference
13+
-------------
14+
15+
.. autoclass:: pyhealth.interpret.methods.lime.LimeExplainer
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
19+
:member-order: bysource

0 commit comments

Comments
 (0)