An attempt to implement the Constinuency Tree LSTM in "Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks" (Tai, Socher, and Manning, 2015) in Theano.
- Python 2.7
- NumPy
- Theano
- gensim
- Stanford Sentiment Treebank in PTB Tree format: download
- pretrained word2vec word vectors trained on Google News, available here
- download the source files or clone the repo
- download the Stanford Sentiment Treebank in PTB format using the above link
- download the pre-trained word2vec vectors using the above link, and unzip the file
To run using default settings:
python constituency_tree_lstm.py /path/to/stanfordSentimentTreebank/trees --word2vec_file=/path/to/GoogleNews-vectors-negative300.bin
To see additional options:
python constituency_tree_lstm.py -h
The original Constituency Tree LSTM was implemented in Torch. In addition, the following are different about this implementation
- no minibatches
- adjusted learning rate and regularization strength to compensate for minibatches of size=1
- using word2vec vectors, instead of Glove
- no updatting of embeddings during training
Performance is not yet equivalent to the results of the original paper, perhaps because of the above differences. The best performance I have been able to obtain thus far is ~0.85 on the binary classification task.