condo-adapter
ConDo Adapter performs Confounded Domain Adaptation, which corrects for batch effects while conditioning on confounding variables. We hope it sparks joy as you clean up your data!
Installation
Installation from pip
You can install the toolbox through PyPI with:
pip install condo
Note: If you have issues with importing torchmin, you may need to install from source, as shown below. Or you can try re-installing pytorch-minimize from source.
Installation from source
After cloning this repo, install the dependencies on the command-line via:
pip install -r requirements.txt
In this directory, run
pip install -e .
Usage
Import ConDo and create the adapter:
from condo import ConDoAdapterKLD
condoer = ConDoAdapterKLD()
Try using it:
import numpy as np
X_T = np.sort(np.random.uniform(0, 8, size=(100, 1)))
X_S = np.sort(np.random.uniform(4, 8, size=(100, 1)))
Y_T = np.random.normal(4 * X_T + 1, 1 * X_T + 1)
Y_Strue = np.random.normal(4 * X_S + 1, 1 * X_S + 1)
Y_S = 5 * Y_Strue + 2
condoer.fit(Y_S, Y_T, X_S, X_T)
Y_S2T = condoer.transform(Y_S)
print(f"before ConDo: {np.mean((Y_S - Y_Strue) ** 2):.3f}")
print(f"after ConDo: {np.mean((Y_S2T - Y_Strue) ** 2):.3f}")
More thorough examples are provided in the examples directory, and all code for experiments are in the papers directory.
Development
Testing
In this directory run
pytest
Citing this toolbox
If you use this toolbox in your research and find it useful, please cite ConDo using the following reference to the TMLR paper:
In Bibtex format:
@article{
mccarter2024towards,
title={Towards Backwards-Compatible Data with Confounded Domain Adaptation},
author={Calvin McCarter},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2024},
url={https://openreview.net/forum?id=GSp2WC7q0r},
note={}
}
License Information
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Metadata
Release files for condo 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| condo-1.1.0.tar.gz | 30.5 kB | Without provenance | Details for condo-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| condo-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for condo-1.1.0-py3-none-any.whl |
Total release size: 65.2 kB
Release files / condo-1.1.0.tar.gz
| Download URL | condo-1.1.0.tar.gz |
|---|---|
| Size | 30.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4124bbe99864abd7c90b3949dcc28e5deec62a92914bcfcb23e22e6185cf8277
|
|
BLAKE2b-256 checksum How to use checksums |
38c99221642787a30bf86c3e28f335774f08a5a87788a50ac78f3551f2105aea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.18
|
Release files / condo-1.1.0-py3-none-any.whl
| Download URL | condo-1.1.0-py3-none-any.whl |
|---|---|
| Size | 34.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97929c53bfcb5e5d293ffd9f196310ba71b78f45cc9ec8b2e3768a5ff281ef81
|
|
BLAKE2b-256 checksum How to use checksums |
47bf85f78f0c081e0483b2eeae3921a3f74fed284898072522e118c90e4ac804
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.18
|
Security for condo 1.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.