https://github.com/mkirchmeyer/ostar
Official Code for "Mapping conditional distributions for domain adaptation under generalized target shift" - ICLR2022
https://github.com/mkirchmeyer/ostar
domain-adaptation label-shift
Last synced: 10 months ago
JSON representation
Official Code for "Mapping conditional distributions for domain adaptation under generalized target shift" - ICLR2022
- Host: GitHub
- URL: https://github.com/mkirchmeyer/ostar
- Owner: mkirchmeyer
- License: mit
- Created: 2022-02-03T13:15:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-03T15:58:25.000Z (over 4 years ago)
- Last Synced: 2025-08-14T09:23:56.300Z (11 months ago)
- Topics: domain-adaptation, label-shift
- Language: Python
- Homepage: https://openreview.net/forum?id=sPfB2PI87BZ
- Size: 29.3 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mapping Conditional Distributions for Domain Adaptation Under Generalized Target Shift
This repository contains the official code of OSTAR in ["Mapping Conditional Distributions for Domain Adaptation Under Generalized Target Shift"][1] (ICLR 2022).
### Quickstart
* Install the requirements `pip install -r requirements.txt`
* Run training. ex: `python run.py -t 000000000001 -d digits -i 1 -g 0 -s 10`
* Results are logged in `./results/run_id` where run_id is the id of the run.
### Options
```
python run.py [-t MODEL] [-d DATASET] [-i RUN_ITERATIONS] [-g GPUID] [-s SETTING]
```
- Choose the model (see Section 5 of the paper for more details):
- `-t 100000000000`: `Source`
- `-t 010000000000`: `DANN`
- `-t 001000000000`: `WD_beta` for beta = 0
- `-t 000111100000`: `WD_beta` for beta in {1, 2, 3, 4}
- `-t 000000011000`: `MARSg` / `MARSc`
- `-t 000000000100`: `IW-WD`
- `-t 000000000010`: `WD_gt` with true class-rations
- `-t 000000000001`: `OSTAR`
- Choose the dataset:
- `-d digits`: Digits
- `-d office`: Office31 and OfficeHome. Requires downloading pre-computed features at https://github.com/jindongwang/transferlearning/blob/master/data/dataset.md
- `-d visda`: VisDA12. Requires downloading pre-computed features at http://csr.bu.edu/ftp/visda17/clf/ and preprocessing downloaded file with `prepare_data_visda12.py`
- Choose the number of runs (e.g. 1 for a single run)
- Choose the gpu id (e.g. 0)
- Choose the label shift setting defined in `compare_digits_setting.py`, `compare_office_setting.py`, `compare_visda_setting.py`
## Citation
```
@inproceedings{Kirchmeyer2022,
title={Mapping conditional distributions for domain adaptation under generalized target shift},
author={Matthieu Kirchmeyer and Alain Rakotomamonjy and Emmanuel de Bezenac and patrick gallinari},
booktitle={International Conference on Learning Representations},
year={2022},
url={https://openreview.net/forum?id=sPfB2PI87BZ}
}
```
[1]: https://openreview.net/forum?id=sPfB2PI87BZ