Weighting Adversarial Neural Network
An online demo of the algorithm is available at https://anonymousaccount0.github.io/demo/
Synthetic Experiment Setup | No Reweighting |
---|---|
TrAdaBoostR2 | WANN |
WANN is a supervised domain adaptation method suited for regression tasks. The algorithm is an instance-based method which learns a reweighting of source instance losses in order to correct the difference between source and target distributions.
WANN algorithm consists to train three networks in parallel in the same gradient descent. The weighting network W learns the source instances weights which are multiplied to the source losses of the task and discrepancy networks ht and hd. The last network, which estimates the Y-discrepancy between the reweighted source and target instances, is trained with an opposite objective function (-G) than the two others. This is done by using a Reversal Gradient Layer (RGL) in bold on the Figure.
Code for the numerical experiments requires the following packages:
tensorflow
(>= 2.0)scikit-learn
numpy
cvxopt
nltk
(for sentiment analysis pre-processing)matplotlib
(for visualization)
The file environment.yml
can be used to reproduce the same conda environment as the one used to conduct the experiments with the following command line:
$ conda env create -f environment.yml
⚠️ The environment has been built on Windows, it seems that the above command line does not work on Ubuntu. If you use this operating system, please create a new environment and install the above packages usingconda install
orpip install
.
WANN algorithm is compared to several instances-based domain adaptation base-lines:
- KMM Huang et al.
- KLIEP Sugiyama et al.
- TrAdaBoostR2 Pardoe et al.
- GDM Cortes et al.
- DANN Ganin et al.
The implementation of the methods can be found in the wann\methods
folder. For GDM, code can be found at https://cims.nyu.edu/~munoz/
The experiments are conducted on one synthetic and three benchmark datasets:
- Superconductivity UCI
- Kin 8xy family Delve project
- Amazon reviews cs.jhu
The code of the synthetic experiment can be found in the following notebook notebooks\Toy_experiments.ipynb
Running superconductivity experiments can be done in two ways:
- In the command line with:
$ python wann\uci_experiments.py
- Within the following notebooks:
notebooks\UCI_experiments.ipynb
Running kin experiments can be done in two ways:
- In the command line with:
$ python wann\kin_experiments.py
- Within the following notebooks:
notebooks\Kin_experiments.ipynb
Running sentiment analysis experiments can be done in two ways:
- In the command line with:
$ python wann\sa_experiments.py
- Within the following notebooks:
notebooks\sa_experiments.ipynb