Skip to main content

pathlaw

Supervised Pathway Projection + Symbolic Regression for Interpretable Drug Response Prediction

PyPI License: MIT GitHub

pathlaw compresses a deep drug response model's latent representation into biologically named pathway scores, then fits a symbolic regression head — producing a single, globally readable formula:

lnIC50 ≈ 2.51 × EML(x, y) − 2.09
  x (resistance) = +1.56·KRAS  +1.12·DNA_REPAIR  +1.04·G2M  + ···
  y (sensitivity) = +0.87·APOPTOSIS  +0.70·PI3K_AKT  + ···

No post-hoc aggregation. No direction analysis. No manual interpretation.
The formula is the explanation.

Install

pip install pathlaw

Quick start

from pathlaw import PathLaw

# X: intermediate representations from your model  (N, n_input)
# y: target values, e.g. lnIC50                    (N,)
model = PathLaw(n_input=1536, n_pathways=8, depth=3)
model.fit(X, y, epochs=300)

print(model.formula())   # human-readable formula
print(model.explain())   # clinical sentences from coefficients

How it works

Your model's latent (1536-dim)
        ↓
Pathway Projection  Linear(1536 → 8)   ← trainable, named after Hallmark gene sets
        ↓
EML Symbolic Head   depth-3 tree       ← learns lnIC50 ≈ EML(x, y)
        ↓
Formula + clinical sentences           ← 0 analyst steps

The 8 default pathways (HALLMARK_PATHWAYS): APOPTOSIS, G2M_CHECKPOINT, DNA_REPAIR, PI3K_AKT_MTOR, KRAS_SIGNALING, ESTROGEN_RESPONSE, HYPOXIA, E2F_TARGETS

You can supply any pathway names matching your domain.

API

Method Description
PathLaw(n_input, n_pathways, depth, pathway_names) Create model
model.fit(X, y, epochs, ...) Train on intermediate reps + targets
model.predict(X) Predict lnIC50
model.pathway_scores(X) Get named pathway activations
model.formula() Human-readable formula string
model.explain(threshold) Clinical sentences from coefficients
model.formula_dict() Full formula as dict (includes LaTeX)
model.evaluate(X, y) Pearson r, Spearman ρ, RMSE
model.save(path) / PathLaw.load(path) Persistence

Citation

If you use pathlaw in your research, please cite:

@article{hong2026pathlaw,
  author  = {Hong, Seokchol},
  title   = {Supervised Pathway Projection with Symbolic Regression
             Enables Interpretable Drug Response Prediction},
  year    = {2026},
  url     = {https://github.com/seokcholhong/pathlaw}
}

License

MIT

Metadata

Release files for pathlaw 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pathlaw 0.1.0
File Size Uploaded Provenance Actions
pathlaw-0.1.0.tar.gz 24.4 kB Without provenance Details for pathlaw-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pathlaw 0.1.0
File Interpreter ABI Platform Actions
pathlaw-0.1.0-py3-none-any.whl Python 3 none any Details for pathlaw-0.1.0-py3-none-any.whl

Total release size: 48.0 kB

Release files / pathlaw-0.1.0.tar.gz

Download URL pathlaw-0.1.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dc76a7077247624ec2234911d866961c89db7f6be776916ed78c421bcbe7c7b7
BLAKE2b-256 checksum
How to use checksums
0bcc090e113fc10a512459b7a38eaa1c27c8d9001e831b5987eac644468aefa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pathlaw-0.1.0-py3-none-any.whl

Download URL pathlaw-0.1.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec5eb51cfe6ae409e250d4caf0db5e5f7719e4d3ecbae05fa7ba81f1b32df7ef
BLAKE2b-256 checksum
How to use checksums
b98a7b019e228a914c4053645b41ae0e4e7d5c362ad0836bcda41d89cfdb66c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for pathlaw 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page