Explanation of RNN Input format

17 views
Skip to first unread message

Ali Safaya

unread,
Dec 21, 2020, 10:35:10 AM12/21/20
to COMP541
Hi all,

In the iterator step of the LSTM NER Tagger lab, we said that your RNN's input needs to be in flattened format. The steps are as follows:

for each batch:
    define input_array
    sort sequences by their length (longer first)
    for each timestep_i in longest sample
        for each sequence s in ordered_sequences
             add unit_i of sequence s to our input array

Here is an example of how this would result:

Sequences:
 "_UNK_ is the tenth album from Japanese _UNK_ _UNK_ band The Mad _UNK_ _UNK_ ."
 "This album proved to be more commercial and more _UNK_ than _UNK_ , with heavily synthesized songs like _UNK_ _UNK_ and Come ."
 "_UNK_ member _UNK_ _UNK_ played guitar on Good Day , and _UNK_ cover of a song by UK post punk industrial band _UNK_ _UNK_ ."
 "_UNK_ can of This had a different meaning , and most people did n't understand what the song was about ."
 "it was later explained that the song was about _UNK_ ( ' can of this ' sounding like _UNK_ when said faster ) it is uncertain if they were told to change the lyric like they did on _UNK_ and _UNK_ ."
 "UK Edition came with the _UNK_ video , and most of the tracks were _UNK_ ."
 "The _UNK_ was formed at Camp Howe , near Pittsburgh , on September 1 , 1862 ."
 "Frederick H. Collier was the first colonel ."
 "After _UNK_ the dead on the field of Second Battle of Bull Run , the regiment was attached to Howe 's Brigade of Couch 's Division of the IV Corps of the Army of the Potomac where it replaced De _UNK_ 's _UNK_ New York , _UNK_ Lafayette regiment on September 11 , 1862 ."
 "The composition of this brigade remained unchanged from this point until the war 's end and included the _UNK_ NY , _UNK_ _UNK_ , _UNK_ _UNK_ and the _UNK_ _UNK_ ."
 "During this time Couch 's Division was detached from the Army and was occupied with guarding the _UNK_ on the Potomac ."
 "The _UNK_ along with its brigade and division spent the next week marching from _UNK_ to Sandy Hook , Maryland from where on September 17 , 1862 , it was forced marched to the Battle of Antietam where it was placed in line of battle but did not see any significant combat ."
 "The next day , the regiment pursued the Confederate army and fought in a skirmish at _UNK_ ."
 "The _UNK_ was transferred in October 1862 to the VI Corps ."
 "In the Battle of _UNK_ , it suffered minor casualties from artillery fire , but did n't get a chance to fight ."
 "Five months later , however , it did participate in the 2nd Battle of _UNK_ ."

Model Input:

"After The it The _UNK_ This In During _UNK_ The The UK Five _UNK_ The Frederick _UNK_ _UNK_ was composition member album the this can next _UNK_ Edition months is _UNK_ H. the along later of _UNK_ proved Battle time of day was came later the was Collier dead with explained this _UNK_ to of Couch This , formed with , tenth transferred was on its that brigade played be _UNK_ 's had the at the however album in the the brigade the remained guitar more , Division a regiment Camp _UNK_ , from October first field and song unchanged on commercial it was different pursued Howe video it Japanese 1862 colonel of division was from Good and suffered detached meaning the , , did _UNK_ to . Second spent about this Day more minor from , Confederate near and participate _UNK_ the Battle the _UNK_ point , _UNK_ casualties the and army Pittsburgh most in band VI of next ( until and than from Army most and , of the The Corps Bull week ' the _UNK_ _UNK_ artillery and people fought on the 2nd Mad . Run marching can war cover , fire was did in September tracks Battle _UNK_ , from of 's of with , occupied n't a 1 were of _UNK_ the _UNK_ this end a heavily but with understand skirmish , _UNK_ _UNK_ . regiment to ' and song synthesized did guarding what at 1862 . . was Sandy sounding included by songs n't the the _UNK_ . attached Hook like the UK like get _UNK_ song . to , _UNK_ _UNK_ post _UNK_ a on was Howe Maryland when NY punk _UNK_ chance the about 's from said , industrial and to Potomac . Brigade where faster _UNK_ band Come fight . of on ) _UNK_ _UNK_ . . Couch September it , _UNK_ 's 17 is _UNK_ . Division , uncertain _UNK_ of 1862 if and the , they the IV it were _UNK_ Corps was told _UNK_ of forced to . the marched change Army to the of the lyric the Battle like Potomac of they where Antietam did it where on replaced it _UNK_ De was and _UNK_ placed _UNK_ 's in . _UNK_ line New of York battle , but _UNK_ did Lafayette not regiment see on any September significant 11 combat , . 1862 ."

Ali

Ali Safaya

unread,
Nov 12, 2021, 6:54:39 AM11/12/21
to COMP541
Reply all
Reply to author
Forward
0 new messages