Code Monkey home page Code Monkey logo

sentence-selection's Introduction

Deep Learning for Answer Sentence Selection Reconstruction

This work started as an attempt to reproduce Yu et al.'s http://arxiv.org/abs/1412.1632

Used word embeddings: pre-trained GloVe vectors from http://nlp.stanford.edu/projects/glove/

So far implemented:

  • Bag of words + basic gradient descent learning classification
  • Bag of words + basic gradient descent learning classification + word counts logistic regression

Development Instructions

For sentence selection development, used dataset: TREC-based originally by Wang et al., 2007; in the form by Yao et al., 2013 as downloaded from https://code.google.com/p/jacana/

Preprocessing (not required):

  • Run save.py first with updated filepath constants (const.py) if you have different dataset (requires jacana formating)

Train and test:

  • Run train.py for training from TREC TRAIN dataset and testing from TREC TEST dataset

  • train.py generates truth.txt and res.txt, to evaluate using the official trec_eval tool, run

    trec_eval -a truth.txt res.txt

TODO:

  • CNN instead of bag of words unigram averaging for aggregate embeddings.

Results (evaluated using stock TREC scripts):

MRR MAP
TRAIN 0.7312 0.6551
TRAIN-ALL 0.7308 0.6566
TRAIN+count 0.7763 0.7165
TRAIN-ALL+count 0.8128 0.7258

Property selection in yodaqa/moviesC:

Folow these steps if you want to retrain currently used weights:

  • Gather input data (labelled tuples) according to the instructions in YodaQA data/ml/embsel/README.md.

  • Run './std_run.sh -p PATH' (PATH is the directory of dumped yodaqa files). You can alter the training constants in basicgrad.py and train.py.

  • If you are happy with the results, you copy the generated file data/Mbtemp.txt to yodaqa src/main/resources/cz/brmlab/yodaqa/analysis/rdf/Mbprop.txt

In summary, use this:

./std_run.sh -p ../yodaqa/data/ml/embsel/propdata
cp data/Mbtemp.txt ../yodaqa/src/main/resources/cz/brmlab/yodaqa/analysis/rdf/Mbprop.txt

Snapshot of results based on curated:

(With a random 1:1 train:test split of the original curated-train.)

Used dataset:

train questions: 270 train sentences: 19624	(generated with curated-measure.sh train)
test questions: 222 test sentences: 17561	(generated with curated-measure.sh train)
2.7902739024% of the properties contains correct answers
random test mrr = 0.0475542678953

Current results:

MMR after unigram learning train: 0.600856454434
MMR after unigram learning test: 0.582881935037

Sentence selection on yodaqa/curated:

Folow these steps if you want to retrain currently used weights:

  • Gather input data (labelled tuples) according to the instructions in YodaQA data/ml/embsel/README.md.

  • Run './std_run.sh -p PATH' (PATH is the directory of dumped yodaqa files). You can alter the training constants in basicgrad.py and train.py.

  • If you are happy with the results, you copy the generated file data/Mbtemp.txt to yodaqa src/main/resources/cz/brmlab/yodaqa/analysis/passextract/Mb.txt

In summary, use this (with YodaQA's f/sentence-selection branch):

./std_run.sh ../yodaqa/data/ml/embsel/sentdata
cp data/Mbtemp.txt ../yodaqa/src/main/resources/cz/brmlab/yodaqa/analysis/passextract/Mb.txt

Snapshot of results based on curated:

(With a random 1:1 train:test split of the original curated-train.)

Used dataset:

train questions: 186 train sentences: 43843	(generated with curated-measure.sh train)
test questions: 429 test sentences: 88779	(generated with curated-measure.sh test)
5.21294450264% of the properties contains correct answers
random test mrr = 0.0760195275186

Current results:

baseline (clue1+0.25*clue2):

MRR unigram+clues train 0.249327071552
MRR unigram+clues test 0.29659580682

glove only:

MMR after unigram learning train: 0.224787152966
MMR after unigram learning test: 0.222749753007

glove+clue1:

MRR unigram+clues train 0.358206351223
MRR unigram+clues test 0.388948882077

sentence-selection's People

Contributors

pasky avatar silvicek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sentence-selection's Issues

Fix reporting of our MRR measures

Right now, we report several MRR measures but it seems the important ones are not well presented:

(i) The Mb model file contains MRR measure that is irrelevant to the Mb model but is MRR of the Mb+clues logregression, is that right? Instead, please take another look at our answer scoring model files. They report cross-validation results, performance on the whole train set, and parameters used when training the model (like the mythical learning rate parameter in our case). Can we get that, please?

(ii) I added print('Mb MRR on train:', mrr(M,b,trainlist)). Can you confirm if this make sense, is this value really Mb MRR on whole train?

Document train.py's train() function

The train() function seems very chaotic to me right now. I'd like to ask we could clearly separate the computation of the Mb model and the computation of the Mb+clues model. Ideally to separate functions called from train().

Regarding CNN implementation

I took a look at the paper and want to implement its CNN version. I am not sure how CNN is trained. CNN output seems to be a vector representation of Sentence. But I am not sure what the loss function is. Can you explain?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.