#
An SKLearn-style toolbox for estimating and analyzing models, distributions, and functions with context-specific parameters.
Context-specific parameters:
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.
pip install contextualized-ml
Take a look at the easy demo for a quickstart with sklearn-style wrappers.
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)$.
model.predict_params(C)
See the docs for more examples.
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}
}
Add your own contributions by sending a PR or request an improvement by creating an issue. See CONTRIBUTING.md for more info.
Contextualized ML was originally implemented by Caleb Ellington (CMU) and Ben Lengerich (MIT).
Beyond code contributions, many people have helped. Check out ACKNOWLEDGEMENTS.md!
Please get in touch with any questions, feature requests, or applications by using the GitHub discussions page.