Skip to content

Reproducible study of anchored transfer learning under distribution shift

License

Notifications You must be signed in to change notification settings

nxd914/transfer-learning-theory

Repository files navigation

Anchored Transfer with Compatibility Metrics

License: MIT Python 3.9+ LaTeX

Reproducible study of anchored transfer learning under distribution shift. Includes real-data experiments (MNIST→USPS, Adult subgroup shift, Electricity time shift), compatibility metrics, a CLI, and a fully generated LaTeX paper.


Requirements

  • Python 3.9+
  • LaTeX + latexmk (TeX Live, MiKTeX, or MacTeX)

Clone and Install

git clone https://github.com/noahd0/anchored-transfer.git
cd anchored-transfer
python -m pip install -e ".[dev]"

Full Pipeline (Experiments -> Figures -> Tables -> Paper)

make all

Outputs:

  • results/real.csv
  • paper/figures/performance_bars.pdf
  • paper/figures/compatibility_scatter.pdf
  • paper/tables/summary.tex
  • paper/tables/failure_rates.tex
  • paper/paper.pdf

Run Steps Manually

python scripts/run_real_experiments.py
python scripts/make_figures.py
python scripts/make_tables.py
make -C paper

CLI

python -m anchored_transfer.cli --help

Compute Compatibility Metrics

python -m anchored_transfer.cli compute-metrics \
    --anchor_labels path/to/anchor_labels.npy \
    --pred_target path/to/target_predictions.npy \
    --pred_transfer path/to/transfer_predictions.npy

Run Real-Data Experiments

python -m anchored_transfer.cli run-real \
    --output results/real.csv

See python -m anchored_transfer.cli run-real --help for all options.


Repository Structure

.
├── code/
│   ├── compute_compatibility.py
│   └── requirements.txt
├── scripts/
│   ├── run_real_experiments.py
│   ├── make_figures.py
│   └── make_tables.py
├── src/
│   └── anchored_transfer/
│       ├── __init__.py
│       ├── cli.py
│       ├── data.py
│       ├── estimators.py
│       ├── experiments.py
│       └── metrics.py
├── tests/
│   ├── conftest.py
│   ├── test_cli.py
│   └── test_metrics.py
├── paper/
│   ├── paper.tex
│   ├── sections/
│   ├── references.bib
│   └── Makefile
├── Makefile
├── pyproject.toml
├── CITATION.cff
└── LICENSE

Tests

make test

Citation

@article{donovan2025anchored,
  title={Anchored Transfer with Compatibility Metrics},
  author={Donovan, Noah},
  journal={arXiv preprint arXiv:XXXX.XXXXX},
  year={2025}
}

@software{anchored_transfer2026,
  title={Anchored Transfer: Reproducible Research Artifact},
  author={Donovan, Noah},
  year={2026},
  url={https://github.com/noahd0/anchored-transfer}
}

License

MIT License. See LICENSE.

Last Updated: January 2026
Version: 1.0.0

About

Reproducible study of anchored transfer learning under distribution shift

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published