Code Monkey home page Code Monkey logo

darn's Introduction

Domain AggRegation Network (DARN)

DARN structure PyTorch implementation of the ICML 2020 paper Domain Aggregation Networks for Multi-Source Domain Adaptation. Certain codes of this repo are adapted from the MDAN repo. If you have any questions, feel free to email to [email protected].

Prerequisites (Tested Environment)

  • Python 3.7.2
  • PyTorch 1.4.0
  • Numpy 1.18.1
  • Matplotlib 3.2.1

How to Run

To produce the plots of the synthetic regression problem in the paper:

python synthetic_regression.py

For the real-world problems (Amazon/Digits/Office-Home), you need to download the corresponding datasets and put the data files in the ./datasets folder.

  • Amazon. The dataset is available from the MDAN repo.
  • Digits. (The preprocessing code is in digits_prepro.py, with some more dependencies.)
  • Office-Home. To save computation time, the code here is using the pre-trained ResNet-50 features. You can also try the original dataset.

To run the experiment

python main.py --name='amazon'

Then the results will be stored in the ./results folder. You can also run python main.py -h to see more options.

To use DARN for other problems, you need to tune the hyperparameters. Specifically, the following hyperparameters may be important:

  • Adversarial loss weight --mu, as suggested by MDAN.
  • Inverse temperature parameter --gamma. As discussed in the paper, the temperature $\tau$ balances the weights on different source domains. $\gamma=1/\tau$ is the inverse temperature.

About the L2 Projection

One of the key components is the L2 projection, which is implemented in module.py. The forward pass uses a binary search to find the optimal threshold and saves some essential quantities for the backward pass. The backward pass computes the Jacobian-vector product as described in the appendix of the paper.

Citation

If you find this repo helpful, please give this repo a star and cite our paper:

@inproceedings{wen2020domain,
  title={Domain Aggregation Networks for Multi-Source Domain Adaptation},
  author={Wen, Junfeng and Greiner, Russell and Schuurmans, Dale},
  booktitle={International Conference on Machine Learning},
  pages={10927--10937},
  year={2020}
}

darn's People

Contributors

junfengwen avatar

Watchers

 avatar  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.