与えられた2つの文章が前提と仮説の関係になっているかクラス分類するデータセットとしてSNLIがあります.
この問題を解くために学習済みのWord2Vec1とLSTMを組み合わせたモデルをKerasで実装してみたという内容です.
SNLI2データセットの詳細については記事「SNLIデータセットの読み込み方」3に記載しています.
参考になれば幸いです.
前準備
SNLIデータセットのダウンロード
The Stanford Natural Language Inference (SNLI) Corpusよりダウンロードできます.
wget https://nlp.stanford.edu/projects/snli/snli_1.0.zip
unzip snli_1.0.zip
学習済みWord2Vecの重みのダウンロード
Google Newsによって学習済みのWord2Vecの重みは下記サイト1のリンク"GoogleNews-vectors-negative300.bin.gz"からダウンロードできます.
実装
学習済みWord2VecとLSTMを組み合わせたモデルをSNLIデータセットで学習を行うコード4です.記事5が参考になります.
実験結果
- Train: 82.01%
- Valid: 80.12%
- epoch数: 18
となり,既存の300D LSTM6と同程度の性能が出せていることが確認できます.
ここから更に性能を上げるためにDecomposable Attention7 8やESIM9 10が使えたりします.
References
-
Milkolov et al., Efficient Estimation of Word Representations in Vector Space, 2013. ↩
-
Bowman et al., A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2015. ↩
-
namakemono, SNLIデータセットの読み込み方, 2017. ↩
-
namakemono, Trains a LSTM with Word2Vec on the SNLI Dataset., 2017. ↩
-
lystdo, LSTM with word2vec embeddings, 2017. ↩
-
Bowman et al., The Stanford Natural Language Inference (SNLI) Corpus. ↩
-
Parikh, A Decomposable Attention for Natural Language Inference, 2016.(Decomposable Attentionの原論文) ↩
-
namakemono, Decomposable Attentionアルゴリズムの解説と実装, 2017. ↩
-
Chen, Enhanced LSTM for Natural Language Inference, 2017. (ESIMの原論文) ↩
-
namakemono, ESIMアルゴリズムの解説と実装, 2017. ↩