Code for Topic Driven Adaptive Network for Cross-Domain Sentiment Classification.
- python 3.8.8
- pytorch 1.8.1
- gensim 4.0.1
- nltk 3.6.2
- numpy 1.20.2
- OS: Ubuntu 20.04.2 LTS
- GPU: NVIDIA TITAN 1080Ti * 2
- CUDA: 10.2
preProcess.py
: the code of prepare dataparameter.py
: the parameter for trainingtrain.py
: run all cross-domain tasksmodel.py
: the code of TDANraw_data/
: unprocessed dataprocessedData/
: processed dataresult/
: training resultmodel/
: model filewordvec
: word embeddings
Download Google Word2Vec. Extract the file and put it under the ./wordvec
folder.
Run preProcess
to prepare the data. This step involves training of LDA so it might takes a moment. LDA is by default trained with four threads and you can adjust the thread number according to your cpu.
python preProcess.py
./run.sh