butsugiri / chainer-abcnn Goto Github PK
View Code? Open in Web Editor NEWRe-implementation of Attention-Based Convolutional Neural Network (ABCNN) by Chainer
Re-implementation of Attention-Based Convolutional Neural Network (ABCNN) by Chainer
Dear Butsugiri,
Thank you for sharing your code. I just have a clarification about dataprocessor.vocab
variable. After running the following lines:
data_processor = DataProcessor(args.data, args.vocab, args.test, args.max_length)
data_processor.prepare_dataset()
data_processor.compute_max_length()
train_data = data_processor.train_data
dev_data = data_processor.dev_data
test_data = data_processor.test_data
dataprocessor.vocab
variable only has 2 entries and and hence this will be the input to the model creation.
cnn = ABCNN(n_vocab=len(vocab), embed_dim=embed_dim, input_channel=input_channel,
output_channel=50, x1s_len=x1s_len, x2s_len=x2s_len, model_type=model_type, single_attention_mat=args.single_attention_mat) # ABCNNはoutput = 50固定らしいが.
model = Classifier(cnn, lossfun=sigmoid_cross_entropy,
accfun=binary_accuracy)
if args.glove:
cnn.load_glove_embeddings(args.glove_path, data_processor.vocab)
if args.word2vec:
cnn.load_word2vec_embeddings(args.word2vec_path, data_processor.vocab)
if args.gpu >= 0:
cuda.get_device(args.gpu).use()
model.to_gpu()
cnn.set_pad_embedding_to_zero(data_processor.vocab)
Sorry, I haven't finished reading the whole code but I wonder at this point if that is the intention of that variable or it should have contained all the vocab in the dataset?
Cheers,
Kurt
Dear Butsugiri,
Thank you for sharing your code. I have a question about the input dataset which I would need to jsonify. I download the dataset and used the respective data partitions, for example, WikiQA-test.tsv for test set which has a sample file entry below.
QuestionID Question DocumentID DocumentTitle SentenceID Sentence Label
Q0 HOW AFRICAN AMERICANS WERE IMMIGRATED TO THE US D0 African immigration to the United States D0-0 African immigration to the United States refers to immigrants to the United States who are or were nationals of Africa . 0
Now, I'm confused because in the jsonify code, the question
would point to D0-0
which is the sentenceID. It seems that the question_id
and the question
were interchanged, am I right or did I miss out anything?
question_id = data[1]
....
question = data[-3]
answer = data[-2]
....
....
'question': question.lower().split(" "),
'answer': answer.lower().split(" "),
should have been the following?
question = data[1]
.....
question_id = data[-3]
answer = data[-2]
....
....
'question': question.lower().split(" "),
'answer': answer.lower().split(" "),
Cheers,
Kurt
Could you upload the data?
Dear Butsugiri,
Thank you for sharing your code. I just have a clarification about dataprocessor.vocab
variable. After running the following lines:
data_processor = DataProcessor(args.data, args.vocab, args.test, args.max_length)
data_processor.prepare_dataset()
data_processor.compute_max_length()
train_data = data_processor.train_data
dev_data = data_processor.dev_data
test_data = data_processor.test_data
dataprocessor.vocab
variable only has 2 entries and and hence this will be the input to the model creation.
cnn = ABCNN(n_vocab=len(vocab), embed_dim=embed_dim, input_channel=input_channel,
output_channel=50, x1s_len=x1s_len, x2s_len=x2s_len, model_type=model_type, single_attention_mat=args.single_attention_mat) # ABCNNはoutput = 50固定らしいが.
model = Classifier(cnn, lossfun=sigmoid_cross_entropy,
accfun=binary_accuracy)
if args.glove:
cnn.load_glove_embeddings(args.glove_path, data_processor.vocab)
if args.word2vec:
cnn.load_word2vec_embeddings(args.word2vec_path, data_processor.vocab)
if args.gpu >= 0:
cuda.get_device(args.gpu).use()
model.to_gpu()
cnn.set_pad_embedding_to_zero(data_processor.vocab)
Sorry, I haven't finished reading the whole code but I wonder at this point if that is the intention of that variable or it should have contained all the vocab in the dataset?
Cheers,
Kurt
Hi,
first of all than you for sharing a code, I was testing your code using Microsoft Research Paraphrase corpus that was tested in the original article as well. But I have a really poor result - accuracy only about 67% that is equal to the major voting strategy, as the majority class is in about 66% cases.
Have you tried your code on this dataset?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.