11. 11
Roozbeh Sanaei
Bidirectional RNN
• Independent RNNs
• Outputs of are concatenated at each time step
• Allows the networks to have both backward and forward information
https://towardsdatascience.com/understanding-bidirectional-
rnn-in-pytorch-5bd25a5dd66
21. 21
Roozbeh Sanaei
Beam Search Failure Analysis
Ground Truth sentence likelihood turns out to be higher
→ 𝐵𝑒𝑎𝑚 𝑆𝑒𝑎𝑟𝑐ℎ 𝑖𝑠 𝑎𝑡 𝐹𝑎𝑢𝑙𝑡
Ground Truth sentence likelihood turns out to be lower
→ 𝑅𝑁𝑁 𝑀𝑜𝑑𝑒𝑙 𝑖𝑠 𝑎𝑡 𝐹𝑎𝑢𝑙𝑡
22. 22
Roozbeh Sanaei
Bleu Score
R1: but thou shalt love thy neighbor as thyself
R2: but have love for your neighbor as for yourself
R3: but love your neighbors as you love yourself
D: but love other love friend for love yourself
D(but)=1
D(love)=3
D(other)=1
D(friend)=1
D(for)=1
D(yourself)=1
R(but)=1
R(love)=2 [appears twice in R3]
R(other)=0
R(friend)=0
R(for)=2 [appears twice in R2]
R(yourself)=1
MIN(D(but), R(but))=MIN(1, 1)=1
MIN(D(love), R(love))=MIN(3, 2)=2
MIN(D(other), R(other))=MIN(1, 0)=0
MIN(D(friend), R(friend))=MIN(1,0)=0
MIN(D(for), R(for))=MIN(1, 2)=1
MIN(D(yourself), R(yourself))=MIN(1,1)=1
Total= 5 Total = 5
Bleu Score = 5/8
https://towardsdatascience.com/nlp-metrics-made-simple-the-
bleu-score-b06b14fbdbc1