/treelstm

Tree-structured Long Short-Term Memory networks (http://arxiv.org/abs/1503.00075)

Primary LanguageLuaGNU General Public License v2.0GPL-2.0

Tree-Structured Long Short-Term Memory Networks

An implementation of the Tree-LSTM architectures described in the paper Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks by Kai Sheng Tai, Richard Socher, and Christopher Manning.

Requirements

The Torch/Lua dependencies can be installed using luarocks. For example:

luarocks install nngraph

Usage

First run the following script:

./fetch_and_preprocess.sh

This downloads the following data:

and the following libraries:

The preprocessing script generates dependency parses of the SICK dataset using the Stanford Neural Network Dependency Parser.

Alternatively, the download and preprocessing scripts can be called individually.

For the semantic relatedness task, run:

th relatedness/main.lua

For the sentiment classification task, run:

th sentiment/main.lua

This trains a model for the "fine-grained" 5-class classification sub-task.

For the binary classification sub-task, run:

th sentiment/main.lua --binary

Predictions are written to the predictions directory and trained model parameters are saved to the trained_models directory.

See the paper for details on these experiments.