Skip to content

Instantly share code, notes, and snippets.

@mrdrozdov
Last active October 26, 2016 20:23
Show Gist options
  • Select an option

  • Save mrdrozdov/a0d43963f2e1078b93fe31cd7cd8eeb0 to your computer and use it in GitHub Desktop.

Select an option

Save mrdrozdov/a0d43963f2e1078b93fe31cd7cd8eeb0 to your computer and use it in GitHub Desktop.
Tree States
created with: https://gist.github.com/mrdrozdov/d11739bdf7a9ff5d7c4783de7f8ac161
PADDING: 16
INITIAL SENTENCE: A person on a horse jumps over a broken down airplane
PADDING SENTENCE: EMPTY EMPTY EMPTY EMPTY EMPTY A person on a horse jumps over a broken down airplane
TREE DEPTH: 5
TREE STATES:
These are the hidden states generated with the
TreeLSTM function. The leaves are the words. This
is an array representation of a binary tree:
root=0, left_child=parent*2, right_child=parent*2+1
0: (((('EMPTY', 'EMPTY'), ('EMPTY', 'EMPTY')), (('EMPTY', 'A'), ('person', 'on'))), ((('a', 'horse'), ('jumps', 'over')), (('a', 'broken'), ('down', 'airplane'))))
1: ((('EMPTY', 'EMPTY'), ('EMPTY', 'EMPTY')), (('EMPTY', 'A'), ('person', 'on')))
2: ((('a', 'horse'), ('jumps', 'over')), (('a', 'broken'), ('down', 'airplane')))
3: (('EMPTY', 'EMPTY'), ('EMPTY', 'EMPTY'))
4: (('EMPTY', 'A'), ('person', 'on'))
5: (('a', 'horse'), ('jumps', 'over'))
6: (('a', 'broken'), ('down', 'airplane'))
7: ('EMPTY', 'EMPTY')
8: ('EMPTY', 'EMPTY')
9: ('EMPTY', 'A')
10: ('person', 'on')
11: ('a', 'horse')
12: ('jumps', 'over')
13: ('a', 'broken')
14: ('down', 'airplane')
15: EMPTY
16: EMPTY
17: EMPTY
18: EMPTY
19: EMPTY
20: A
21: person
22: on
23: a
24: horse
25: jumps
26: over
27: a
28: broken
29: down
30: airplane
OUTPUT STATES (post-order traversal):
This is the order that hidden states are attended over,
and the order that they are passed through the second
regular LSTM.
0: EMPTY
1: EMPTY
2: EMPTY
3: EMPTY
4: EMPTY
5: A
6: person
7: on
8: a
9: horse
10: jumps
11: over
12: a
13: broken
14: down
15: airplane
16: ('EMPTY', 'EMPTY')
17: ('EMPTY', 'EMPTY')
18: ('EMPTY', 'A')
19: ('person', 'on')
20: ('a', 'horse')
21: ('jumps', 'over')
22: ('a', 'broken')
23: ('down', 'airplane')
24: (('EMPTY', 'EMPTY'), ('EMPTY', 'EMPTY'))
25: (('EMPTY', 'A'), ('person', 'on'))
26: (('a', 'horse'), ('jumps', 'over'))
27: (('a', 'broken'), ('down', 'airplane'))
28: ((('EMPTY', 'EMPTY'), ('EMPTY', 'EMPTY')), (('EMPTY', 'A'), ('person', 'on')))
29: ((('a', 'horse'), ('jumps', 'over')), (('a', 'broken'), ('down', 'airplane')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment