CADRE implementation for PyHealth #1063
Open
natalie-erj wants to merge 6 commits intosunlabuiuc:masterfrom
Open
CADRE implementation for PyHealth #1063natalie-erj wants to merge 6 commits intosunlabuiuc:masterfrom
natalie-erj wants to merge 6 commits intosunlabuiuc:masterfrom
Conversation
Adds the CADRE (Contextual Attention-based Drug REsponse) model and its dot-product attention extension (CADREDotAttn), along with the GDSC and CCLE cancer cell line datasets needed to train and evaluate them. New datasets: - GDSCDataset (pyhealth/datasets/gdsc.py): 846 cell lines × 260 drugs, binary gene expression + drug sensitivity, Gene2Vec embeddings. Includes drug-name mapping and cross-dataset get_overlap_drugs(). - CCLEDataset (pyhealth/datasets/ccle.py): analogous structure for CCLE; uses drug names as column headers (vs numeric IDs in GDSC). New tasks: - DrugSensitivityPredictionGDSC / DrugSensitivityPredictionCCLE: convert cell-line records to (gene_indices, labels, mask) sample dicts. New models: - CADRE: frozen Gene2Vec + multi-head contextual attention encoder + collaborative filtering dot-product decoder + masked BCE loss. - CADREDotAttn: replaces additive attention with transformer-style scaled dot-product attention using drug embeddings as queries. - cadre_collate_fn: pads variable-length gene_indices within a batch. Tests: 80 unit tests (synthetic data, no real files required). Reference: Tao et al. (2020) MLHC, PMLR 126:456-477. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cadre gdsc ccle contribution
Updating CCLE dataset support and label/name-alignment fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributors:
Natalie Erjavec (Email: erjavec2@illinois.edu / NetID:erjavec2)
Austin Offenberger (Email: austino3@illinois.edu / NetID:austino3)
Prasanna Kumar Muralimanohar(Email: pkm7@illinois.edu / NetID:pkm7)
Contribution Type:
Full path (Dataset + Task + Model + Paper Replication + Extension)
Overview
A reproduction and extension of CADRE (Contextual Attention-based Drug REsponse) within the PyHealth framework, originally published as:
Tao, Y., Ren, S., Ding, M.Q., Schwartz, R., & Lu, X. (2020). Predicting Drug Sensitivity of Cancer Cell Lines via Collaborative Filtering with Contextual Attention. Proceedings of Machine Learning Research, 126, 456–477. PMLR (MLHC 2020).
Original code: github.com/yifengtao/CADRE
Description
This PR adds support for cancer drug sensitivity prediction to PyHealth, including two datasets, two tasks, and two model architectures. The implementation is based on the CADRE paper (Tao et al., MLHC 2020) with an additional dot-product attention extension.
New Datasets
Wraps the Genomics of Drug Sensitivity in Cancer (GDSC) dataset for drug sensitivity prediction. Each patient is a cancer cell line; the single visit represents its genomic profile.
Wraps the Cancer Cell Line Encyclopedia (CCLE) dataset using the same interface as
GDSCDataset.
New Tasks
New Models
CADRE (pyhealth/models/cadre.py)
Re-implementation of Tao et al. (2020). Predicts drug sensitivity via:
drug's target pathway embedding conditions the attention scores, producing a
drug-specific cell-line representation
drug embeddings
The freeze_gene_emb parameter (default True) supports the CADRE pretrain ablation
from the paper by optionally unfreezing the Gene2Vec embeddings during training.
CADREDotAttn (pyhealth/models/cadre_dot_attn.py)
Extension replacing CADRE's additive contextual attention with transformer-style
scaled dot-product attention. Drug embeddings serve as queries against
gene key vectors, so gradients flow through both the prediction path (decoder dot
product) and the attention alignment path (encoder)
Tests
20 unit tests using synthetic in-memory CSV data:
References
Collaborative Filtering with Contextual Attention. MLHC 2020, PMLR 126:456–477.
resource for therapeutic biomarker discovery in cancer cells. Nucleic Acids
Research, 41(D1), D955–D961.
predictive modelling of anticancer drug sensitivity. Nature, 483(7391), 603–607.