NCE-SM model References: The code uses torchtext for text processing. Set torchtext:
git clone https://github.com/pytorch/text.gitcd text
python setup.py install Download the word2vec model from [here] (https://drive.google.com/file/d/0B2u_nClt6NbzUmhOZU55eEo4QWM/view?usp=sharing )
and copy it to the Castor/data/word2vec
folder.
Training the model You can train the SM model for the 4 following configurations:
random - the word embedddings are initialized randomly and are tuned during training
static - the word embeddings are static (Severyn and Moschitti, SIGIR'15)
non-static - the word embeddings are tuned during training
multichannel - contains static and non-static channels for question and answer conv layers
python train.py --no_cuda --mode rand --batch_size 64 --neg_num 8 --dev_every 50 --patience 1000 NB: pass --no_cuda
to use CPU
The trained model will be save to:
saves/static_best_model.pt Testing the model python main.py --trained_model saves/trecqa/multichannel_best_model.pt --batch_size 64 --no_cuda Evaluation The performance on TrecQA dataset: Without NCE Metric rand static non-static multichannel MAP 0.7441 0.7524 0.7688 0.7641 MRR 0.8172 0.8012 0.8144 0.8174
Max Neg Sample To be added
Pairwise + Max Neg Sample with neg_num = 8 Metric rand static non-static multichannel MAP 0.7427 0.7546 0.7716 0.7794 MRR 0.8151 0.8061 0.8347 0.8467
The performance on WikiQA dataset: To be added