All Projects → erickrf → Multiffn Nli

erickrf / Multiffn Nli

Licence: mit
Implementation of the multi feed-forward network architecture by Parikh et al. (2016) for Natural Language Inference.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Multiffn Nli

Text Dependency Parser
🏄 依存关系分析,NLP,自然语言处理
Stars: ✭ 78 (-12.36%)
Mutual labels:  natural-language-processing
Greek Bert
A Greek edition of BERT pre-trained language model
Stars: ✭ 84 (-5.62%)
Mutual labels:  natural-language-processing
Spf
Cornell Semantic Parsing Framework
Stars: ✭ 87 (-2.25%)
Mutual labels:  natural-language-processing
Deepmoji
State-of-the-art deep learning model for analyzing sentiment, emotion, sarcasm etc.
Stars: ✭ 1,215 (+1265.17%)
Mutual labels:  natural-language-processing
Spacy Graphql
🤹‍♀️ Query spaCy's linguistic annotations using GraphQL
Stars: ✭ 81 (-8.99%)
Mutual labels:  natural-language-processing
Practical Open
Oxford Deep NLP 2017 course - Open practical
Stars: ✭ 84 (-5.62%)
Mutual labels:  natural-language-processing
Multimodal Toolkit
Multimodal model for text and tabular data with HuggingFace transformers as building block for text data
Stars: ✭ 78 (-12.36%)
Mutual labels:  natural-language-processing
Virtual Assistant
A linux based Virtual assistant on Artificial Intelligence in C
Stars: ✭ 88 (-1.12%)
Mutual labels:  natural-language-processing
Simplednn
SimpleDNN is a machine learning lightweight open-source library written in Kotlin designed to support relevant neural network architectures in natural language processing tasks
Stars: ✭ 81 (-8.99%)
Mutual labels:  natural-language-processing
Semantic Texual Similarity Toolkits
Semantic Textual Similarity (STS) measures the degree of equivalence in the underlying semantics of paired snippets of text.
Stars: ✭ 87 (-2.25%)
Mutual labels:  natural-language-processing
Ja.text8
Japanese text8 corpus for word embedding.
Stars: ✭ 79 (-11.24%)
Mutual labels:  natural-language-processing
Typenovel
A simple markup language to write novel with types.
Stars: ✭ 80 (-10.11%)
Mutual labels:  natural-language-processing
Turkish Bert Nlp Pipeline
Bert-base NLP pipeline for Turkish, Ner, Sentiment Analysis, Question Answering etc.
Stars: ✭ 85 (-4.49%)
Mutual labels:  natural-language-processing
Practical 3
Oxford Deep NLP 2017 course - Practical 3: Text Classification with RNNs
Stars: ✭ 78 (-12.36%)
Mutual labels:  natural-language-processing
Neural kbqa
Knowledge Base Question Answering using memory networks
Stars: ✭ 87 (-2.25%)
Mutual labels:  natural-language-processing
Chinese Xlnet
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Stars: ✭ 1,213 (+1262.92%)
Mutual labels:  natural-language-processing
Scanrefer
[ECCV 2020] ScanRefer: 3D Object Localization in RGB-D Scans using Natural Language
Stars: ✭ 84 (-5.62%)
Mutual labels:  natural-language-processing
Character Mining
Mining individual characters in multiparty dialogue
Stars: ✭ 89 (+0%)
Mutual labels:  natural-language-processing
Spark Nlp Models
Models and Pipelines for the Spark NLP library
Stars: ✭ 88 (-1.12%)
Mutual labels:  natural-language-processing
Ml
A high-level machine learning and deep learning library for the PHP language.
Stars: ✭ 1,270 (+1326.97%)
Mutual labels:  natural-language-processing

Decomposable Neural Network Models for Natural Language Inference

This code is a Tensorflow implementation of the models described in A Decomposable Attention Model for Natural Language Inference__ and Enhancing and Combining Sequential and Tree LSTM for Natural Language Inference <https://arxiv.org/abs/1609.06038>_ (for the latter, only the sequential model is implemented).

.. __: https://arxiv.org/abs/1606.01933

This architecture is composed of three main steps:

  1. Align. This steps finds word-level alignments between the two sentences. The words in one sentence are compared to the words in the other one, possibly considering their contexts.

  2. Compare. Each word is paired with a representation of the words it is aligned to. This representation is achieved by combining word embeddings, weighted by the strength of the alignment. Neural networks process these combinations.

  3. Aggregate. All word-alignemnt pairs are combined for a final decision with respect to the relation between the two sentences.

Requirements

The code is written in Python 2.7; the main incompatibility with Python 3 currently is the module structure. It runs (at least) on tensorflow versions from 1.2 to 1.5.

Usage

Training ^^^^^^^^

Run train.py -h to see an explanation of its usage. A lot of hyperparameter customization is possible; but as a reference, using the MLP model on SNLI, great results can be obtained with 200 units, 0.8 dropout keep probability (i.e., 0.2 dropout), 0 l2 loss, a batch size of 32, an initial learning rate of 0.05 and Adagrad.

The train and validation data should be in the JSONL format used in the SNLI corpus. The embeddings can be given in two different ways:

1) A text file where each line has a word and its vector with values separated by whitespace or tabs

2) **(faster!)** A numpy file with the saved embedding matrix and an extra text file with the vocabulary, such that its *i*-th line corresponds to the *i*-th row in the matrix.

The code can be run on either GPU or CPU transparently; it only depends on the tensorflow installation.

Running a trained model ^^^^^^^^^^^^^^^^^^^^^^^

In order to run a trained model interactively in the command line, use interactive-eval.py:

::

$ python src/interactive-eval.py saved-model/ glove-42B.npy --vocab glove-42B-vocabulary.txt
Reading model
Type sentence 1: The man is eating spaghetti with sauce.
Type sentence 2: The man is having a meal.
Model answer: entailment

Type sentence 1: The man is eating spaghetti with sauce.
Type sentence 2: The man is running in the park.
Model answer: contradiction

Type sentence 1: The man is eating spaghetti with sauce.
Type sentence 2: The man is eating in a restaurant.
Model answer: neutral

It can also show a heatmap of the alignments.

.. image:: alignments.png

Evaluation ^^^^^^^^^^

Use the script evaluate.py to obtain a model's loss, accuracy and optionally see the misclassified pairs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].