This repo contains the source code for our paper:
Adversarial Training Based Multi-Source Unsupervised Domain Adaptation for Sentiment Analysis
- Python 3.6
- PyTorch 0.4
- PyTorchNet
- scipy
- tqdm (for progress bar)
In this paper, we focus on the multi-source unsupervised domain adaptation for sentiment analysis and desire to combine the hypotheses of multiple labeled source domains to derive a good hypothesis for an unlabeled target domain. For this purpose, we introduce two transfer learning frameworks. The first framework is Weighting Scheme based Unsupervised Domain Adaptation (WS-UDA), in which we integrate the source classifiers to annotate pseudo labels for target instances directly. Our second framework is a Two-Stage Training based Unsupervised Domain Adaptation method (2ST-UDA), which further utilize pseudo labels to train a target-specific extractor.
Our model is divided into two parts. The first part is to get the pre-trained model of each module, and the second part is to use our pre-trained model to get the results of our two transfer learning frameworks.
链接: https://pan.baidu.com/s/1U5GUq99KORj2qYI74oxVZA 提取码: snc4
Using Microsoft's open source tuning tool nni, the final result has a fluctuation of ±0.5%
Before starting to run the program, you must set the values of base_save_dir and exp2_model_save_file (exp3_model_save_file) to store the model and parameter files during the training process.
cd code/
python3 get_pre-trained_model_exp2.pycd code/
python3 WS-UDA_exp2.pycd code/
python3 2ST-UDA_exp2.pycd code/
python3 get_pre-trained_model_exp3.pycd code/
python3 WS-UDA_exp3.pycd code/
python3 2ST-UDA_exp3.py