Coder Social home page Coder Social logo

domainbed's Introduction

This is the implementation of Towards a Theoretical Framework of Out-of-Distribution Generalization. Our code is inherited from DomainBed.

Dataset

Downloads VLCS dataset and link it to

/datasets/VLCS

The structure of dataset should be same as DomainBed. To run our full experiments, one should also download PACS and OfficeHome dataset in the same way.

Single Experiment

To run a single experiment, run the following command:

python -m main --data_dir domainbed/datasets \
--trial_seed 89500 --algorithm ERM --dataset VLCS --test_envs 1 \
--steps 5001 --output_dir logs/ERM_VLCS_test_env1/ \
--extract_feature ERM_exp1  \
--output_result_file result.csv \
--checkpoint_freq 500 \
--save_feature_every_checkpoint \
--hparams "{\"lr\": 0.0001, \"resnet18\": false}" \

The final result will be saved in logs/ERM_VLCS_test_env1/ERM_exp1

Model Selection

To reproduce our experiment, one can run the following code to generate different models for model selection

python my_launcher.py --command_launcher my_multi_gpu launch

After model generation, one should use the following codes to collect feature and metric from different models. The result will be record in renamed/*.csv

cd logs
python collect_feature.py

to use our model selection criterion, one can run

python model_selection.py

This command use the result in renamed/*.csv to select model according to different criterion and report their test evironment accuracy. train_acc means the selection criterion is the average training accuracy, train_mix is the selection criterion defined in our paper

domainbed's People

Contributors

dashu233 avatar daysm avatar dnap512 avatar igul222 avatar jc-audet avatar lopezpaz avatar sirrob1997 avatar yugeten avatar ywolfeee avatar zdhnarsil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.