ofirnachum/tree_rnn
소개
재귀 신경망(Recursive Neural Networks)이라고도 하는 Tree RNN의 Theano 구현입니다.
시스템 및 인프라측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originaltree_rnn
Theano implementation of Tree RNNs aka Recursive Neural Networks.
Includes implementation of TreeLSTMs as described in "Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks" by Kai Sheng Tai, Richard Socher, and Christopher D. Manning.
Also includes implementation of TreeGRUs derived using similar methods.
You may immediately run "dummy" demos via simple_demo.py and modulo_demo.py.
Code for evaluation on the Stanford Sentiment Treebank (used by the paper) is also available in sentiment.py. To run this, you'll need to download the relevant data.
Step-by-step for cloning this repo and getting the sentiment model running:
From your shell, run
git clone https://github.com/ofirnachum/tree_rnn.git
git clone https://github.com/stanfordnlp/treelstm.git
cd treelstm
./fetch_and_preprocess.sh
This will download the datasets, the word vectors, and do some preprocessing on the data. Once this is complete, go into the tree_rnn directory and start a Python shell. In that shell, we'll preprocess the word vectors:
import data_utils
vocab = data_utils.Vocab()
vocab.load('../treelstm/data/sst/vocab-cased.txt')
words, embeddings = \
data_utils.read_embeddings_into_numpy(
'../treelstm/data/glove/glove.840B.300d.txt', vocab=vocab)
import numpy as np
np.save('../treelstm/data/words.npy', words)
np.save('../treelstm/data/glove.npy', embeddings)
After exiting the Python shell, you can run the sentiment training directly
python sentiment.py
The first couple lines of output should be
train 6920
dev 872
test 1821
num emb 21701
num labels 3
epoch 0
avg loss 16.7419t example 6919 of 6920
dev score 0.586009174312
epoch 1
avg loss 13.8955t example 6919 of 6920
dev score 0.69495412844
epoch 2
avg loss 12.9191t example 6919 of 6920
dev score 0.730504587156
관련 프로젝트 살펴보기
불러오는 중…