Contextualized
Contextualized: Heterogeneous Modeling Toolbox - Published in JOSS (2024)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 13 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: arxiv.org, medrxiv.org, sciencedirect.com, joss.theoj.org -
✓Committers with academic emails
2 of 14 committers (14.3%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Scientific Fields
Repository
An SKLearn-style toolbox for estimating and analyzing models, distributions, and functions with context-specific parameters.
Basic Info
- Host: GitHub
- Owner: cnellington
- License: gpl-3.0
- Language: Python
- Default Branch: main
- Homepage: http://contextualized.ml/
- Size: 96.3 MB
Statistics
- Stars: 76
- Watchers: 2
- Forks: 13
- Open Issues: 39
- Releases: 13
Topics
Metadata Files
README.md

An SKLearn-style toolbox for estimating and analyzing models, distributions, and functions with context-specific parameters.
Context-specific parameters: - Find hidden heterogeneity in data -- are all samples the same? - Identify context-specific predictors -- are there different reasons for outcomes? - Enable domain adaptation -- can learned models extrapolate to new contexts?
Most models can be contextualized. For example, linear regression is
math
Y = X\beta + \epsilon
Contextualized linear regression is
math
Y = X\beta(C) + \epsilon
where the coefficients $\beta$ are now a function of context $C$, allowing the model to adapt to context-specific changes.
Contextualized implements this for many types of statistical models, including linear regression, logistic regression, Bayesian networks, correlation networks, and Markov networks.
For more details, see the Contextualized Machine Learning whitepaper.
Quick Start
Installation
pip install contextualized-ml
Take a look at the easy demo for a quickstart with sklearn-style wrappers.
Build a Contextualized Model
from contextualized.easy import ContextualizedRegressor
model = ContextualizedRegressor()
model.fit(C, X, Y, normalize=True)
This builds a contextualized linear regression model by fitting a deep-learning model to generate context-specific coefficients $\beta(C)$.
Predict Context-Specific Parameters
model.predict_params(C)
See the docs for more examples.
Important links
Citing
If you use this software, please cite the software publication:
@article{Ellington2024,
doi = {10.21105/joss.06469},
url = {https://doi.org/10.21105/joss.06469},
year = {2024},
publisher = {The Open Journal},
volume = {9},
number = {97},
pages = {6469},
author = {Caleb N. Ellington and Benjamin J. Lengerich and Wesley Lo and Aaron Alvarez and Andrea Rubbi and Manolis Kellis and Eric P. Xing},
title = {Contextualized: Heterogeneous Modeling Toolbox},
journal = {Journal of Open Source Software}
}
Contributing
Add your own contributions by sending a PR or request an improvement by creating an issue. See CONTRIBUTING.md for more info.
Thanks to all our contributors
Contextualized ML was originally implemented by Caleb Ellington (CMU) and Ben Lengerich (MIT).
Beyond code contributions, many people have helped. Check out ACKNOWLEDGEMENTS.md!
Related Publications and Pre-prints
- Contextualized Machine Learning (ArXiv '23)
- Contextualized: Heterogeneous Modeling Toolbox (JOSS '24)
- Networks
- Applications
- Patient-Specific Models of Treatment Effects Explain Heterogeneity in Tuberculosis (ML4H '24)
- Contextualized Policy Recovery: Modeling and Interpreting Medical Decisions with Adaptive Imitation Learning (ICML '24)
- Automated Interpretable Discovery of Heterogeneous Treatment Effectiveness: A COVID-19 Case Study (JBI '22)
- Discriminative Subtyping of Lung Cancers from Histopathology Images via Contextual Deep Learning (MedRxiv '22)
- Personalized Survival Prediction with Contextual Explanation Networks (ML4H '17)
- Contextual Explanation Networks (JMLR '20)
- Background reading:
Videos
- Cold Spring Harbor Laboratory: Contextualized Graphical Models Reveal Sample-Specific Transcriptional Networks for 7000 Tumors
- Sample-Specific Models for Interpretable Analysis with Applications to Disease Subtyping
Contact Us
Please get in touch with any questions, feature requests, or applications by using the GitHub discussions page.
Owner
- Name: Caleb Ellington
- Login: cnellington
- Kind: user
- Location: Pittsburgh, PA
- Company: Carnegie Mellon University
- Website: https://calebellington.com/
- Repositories: 8
- Profile: https://github.com/cnellington
Computational Biology PhD Student, Carnegie Mellon University
JOSS Publication
Contextualized: Heterogeneous Modeling Toolbox
Authors
Massachusetts Institute of Technology, USA, Broad Institute of MIT and Harvard, USA
Worcester Polytechnic Institute, USA
University of Cincinnati, USA
Cambridge University, UK
Massachusetts Institute of Technology, USA, Broad Institute of MIT and Harvard, USA
Carnegie Mellon University, USA, Mohamed bin Zayed University of Artificial Intelligence, UAE
Tags
Machine Learning Modeling Heterogeneous ContextGitHub Events
Total
- Create event: 5
- Release event: 1
- Issues event: 2
- Watch event: 8
- Delete event: 2
- Issue comment event: 27
- Push event: 23
- Pull request review comment event: 31
- Pull request review event: 28
- Pull request event: 18
- Fork event: 6
Last Year
- Create event: 5
- Release event: 1
- Issues event: 2
- Watch event: 8
- Delete event: 2
- Issue comment event: 27
- Push event: 23
- Pull request review comment event: 31
- Pull request review event: 28
- Pull request event: 18
- Fork event: 6
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Caleb Ellington | c****n@g****m | 281 |
| Ben Lengerich | b****h@g****m | 142 |
| Peter Li | p****i@P****l | 17 |
| wtt102 | w****2@g****m | 16 |
| aaron10l | a****4@g****m | 15 |
| Peter Li | p****i@M****n | 10 |
| Andrea Rubbi | A****i | 9 |
| juwayni lucman | l****i@g****m | 5 |
| Peter Li | p****i@w****u | 5 |
| Jason Paul Miller | j****r@g****m | 3 |
| Peter Li | p****i@w****u | 3 |
| PaulCCCCCCH | p****h@g****m | 2 |
| Jannik Deuschel | 6****C | 1 |
| Baiheng Chen | 1****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 61
- Total pull requests: 131
- Average time to close issues: 5 months
- Average time to close pull requests: 11 days
- Total issue authors: 7
- Total pull request authors: 11
- Average comments per issue: 1.2
- Average comments per pull request: 0.87
- Merged pull requests: 111
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 22
- Average time to close issues: 22 days
- Average time to close pull requests: 12 days
- Issue authors: 3
- Pull request authors: 5
- Average comments per issue: 1.67
- Average comments per pull request: 1.5
- Merged pull requests: 12
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- cnellington (33)
- blengerich (22)
- alexanderchang1 (2)
- vexvexctor (1)
- abhinadduri (1)
- BaihengChen (1)
- holl- (1)
Pull Request Authors
- cnellington (57)
- blengerich (34)
- CheeseLee888 (12)
- aaron10l (10)
- wtt102 (6)
- juwaynilucman (4)
- jxmils (2)
- BaihengChen (2)
- fabian-s (2)
- AndreaRubbi (1)
- Samuel-WM (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 53 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 11
- Total maintainers: 1
pypi.org: contextualized-ml
A statistical machine learning toolbox for estimating models, distributions, and functions with sample-specific parameters.
- Homepage: https://contextualized.ml/
- Documentation: https://contextualized-ml.readthedocs.io/
- License: GNU General Public License v3 (GPLv3)
-
Latest release: 0.2.9
published 11 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- jupyter-book *
- matplotlib *
- numpy *
- dill *
- igraph *
- matplotlib *
- numpy *
- pytorch-lightning <=1.9.4
- scikit-learn *
- torch <=1.13.1
- torchvision *