A statistical machine learning toolbox for estimating models, distributions, and functions with sample-specific parameters.
Project description
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
Y = X\beta + \epsilon
Contextualized linear regression is
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)
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
- Contextualized: Heterogeneous Modeling Toolbox
- Networks
- Applications
- Patient-Specific Models of Treatment Effects Explain Heterogeneity in Tuberculosis
- Contextualized Policy Recovery: Modeling and Interpreting Medical Decisions with Adaptive Imitation Learning
- Automated Interpretable Discovery of Heterogeneous Treatment Effectiveness: A COVID-19 Case Study
- Discriminative Subtyping of Lung Cancers from Histopathology Images via Contextual Deep Learning
- Personalized Survival Prediction with Contextual Explanation Networks
- Contextual Explanation Networks
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file contextualized_ml-0.2.9.tar.gz
.
File metadata
- Download URL: contextualized_ml-0.2.9.tar.gz
- Upload date:
- Size: 19.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5540ce46b680d4ee8910c93621eaa1d1b5faa4d72e59451260c6579fb5c37338 |
|
MD5 | 7fb2b134ebd8d9dbc6d2fdb5ba6a002a |
|
BLAKE2b-256 | 45fbb43495f3d9965c119b5b1862f97127d78614e27b6731a2da30e9f95e93df |
Provenance
The following attestation bundles were made for contextualized_ml-0.2.9.tar.gz
:
Publisher:
publish.yml
on cnellington/Contextualized
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
contextualized_ml-0.2.9.tar.gz
- Subject digest:
5540ce46b680d4ee8910c93621eaa1d1b5faa4d72e59451260c6579fb5c37338
- Sigstore transparency entry: 168014589
- Sigstore integration time:
- Permalink:
cnellington/Contextualized@68f88c198016ab52d5309620a9714b346e0d41b4
- Branch / Tag:
refs/tags/v0.2.9-1
- Owner: https://github.com/cnellington
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
publish.yml@68f88c198016ab52d5309620a9714b346e0d41b4
- Trigger Event:
release
- Statement type:
File details
Details for the file contextualized_ml-0.2.9-py3-none-any.whl
.
File metadata
- Download URL: contextualized_ml-0.2.9-py3-none-any.whl
- Upload date:
- Size: 72.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6909c287c623cbeccf489ed6547819bd52df17b59ac4439f6b095b15b3861c12 |
|
MD5 | e928a4d1153c9854725fdc0b68568360 |
|
BLAKE2b-256 | 22d4238ad5893ca3b2590497f3600022663ae5c2836c1fbe62b18ed9e5d1721d |
Provenance
The following attestation bundles were made for contextualized_ml-0.2.9-py3-none-any.whl
:
Publisher:
publish.yml
on cnellington/Contextualized
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
contextualized_ml-0.2.9-py3-none-any.whl
- Subject digest:
6909c287c623cbeccf489ed6547819bd52df17b59ac4439f6b095b15b3861c12
- Sigstore transparency entry: 168014590
- Sigstore integration time:
- Permalink:
cnellington/Contextualized@68f88c198016ab52d5309620a9714b346e0d41b4
- Branch / Tag:
refs/tags/v0.2.9-1
- Owner: https://github.com/cnellington
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
publish.yml@68f88c198016ab52d5309620a9714b346e0d41b4
- Trigger Event:
release
- Statement type: