资源算法NCE_SM_Pytorch

NCE_SM_Pytorch

2020-01-14 | |  77 |   0 |   0

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:

  1. random - the word embedddings are initialized randomly and are tuned during training

  2. static - the word embeddings are static (Severyn and Moschitti, SIGIR'15)

  3. non-static - the word embeddings are tuned during training

  4. 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
Metricrandstaticnon-staticmultichannel
MAP0.74410.75240.76880.7641
MRR0.81720.80120.81440.8174
Max Neg Sample

To be added

Pairwise + Max Neg Sample with neg_num = 8
Metricrandstaticnon-staticmultichannel
MAP0.74270.75460.77160.7794
MRR0.81510.80610.83470.8467

The performance on WikiQA dataset:

To be added


上一篇: tf-svm

下一篇:ladder_network_keras

用户评价
全部评价

热门资源

  • TensorFlow-Course

    This repository aims to provide simple and read...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • mxnet_VanillaCNN

    This is a mxnet implementation of the Vanilla C...

  • vsepp_tensorflow

    Improving Visual-Semantic Embeddings with Hard ...

  • DuReader_QANet_BiDAF

    Machine Reading Comprehension on DuReader Usin...