In this paper, we present Aligned Adaptation Networks (AAN) to match both the marginal and conditional distributions across domains for UDA.
Two datasets Amazon-Review and Amazon-Text are provided in dataset/ with .json.
Maximum mean discrepancy (MMD) and Conditional MMD (CMMD) are implemented in model/criterion.py
AANs and AAN-As are implmented in model/models.py with three different types of extractors
Model trainings are represented in aan_mlp.ipynb
, aan_cnn.ipynb
and aan_bert.ipynb
.
- Clone this repsitory.
git clone https://github.com/gregbuaa/aan_model.git
cd aan_model
- Install the dependencies. The code runs with PyTorch-1.2.0 in our experiments.
pip install -r requirements.txt
- Play with the Jupyter notebooks.
jupyter notebook
Run all the notebooks to reproduce the experiments on Amazon_Feature with MLP extractor, Amazon_Text_CNN with TextCNN extractor and Amazon_Text_BERT presented in the paper.
AANs can be extended to other different tasks such as Image Classification easily.
@inproceedings{zhang2021discriminative,
title={Discriminative Feature Adaptation via Conditional Mean Discrepancy for Cross-domain Text Classification},
author={Zhang, Bo and Zhang, Xiaoming and Liu, Yun and Cheng, Lei},
booktitle={International Conference on Database Systems for Advanced Applications (DASFAA)},
year={2021}
}