recurrent neural network agenda
play

Recurrent Neural Network Agenda Recurrent Neural Network - PowerPoint PPT Presentation

Recurrent Neural Network Agenda Recurrent Neural Network NER sequence tagging RNN


  1. Recurrent Neural Network

  2. Agenda • Recurrent Neural Network ทําไมถึงเหมาะกับการทํา NER หรือ sequence tagging • RNN มีิวิธีการทํางานอย่างไร มี parameter อะไรบ้าง

  3. O B-LOC O y = label output I-PER B-PER h = hidden activation x = feature vector Quahog Peter lives in Griffin

  4. B-PER y 1 = softmax(W y h 1 + b y ) W h [x 1 ; h 0 ] b h + ) h 1 = tanh ( Peter

  5. I-PER y 2 = softmax(W y h 2 + b y ) B-PER W h [x 2 ; h 1 ] b h + ) h 2 = tanh ( Peter Griffin

  6. O y 3 = softmax(W y h 3 + b y ) I-PER B-PER W h [x 3 ; h 2 ] b h + ) h 3 = tanh ( Peter Griffin lives

  7. O B-LOC O I-PER B-PER Quahog Peter lives in Griffin

  8. Recurrent Neural Network Parameters y t = softmax ( W y ⋅ h t + b y ) h t = tanh( W h ⋅ [ x t ; h t − 1 ]) + b h W y h t b y h t W h [x t ; h t-1 ] b h ) softmax ( + + ) = tanh (

  9. O B-LOC O y = label output I-PER B-PER h = hidden activation x = feature vector Quahog Peter lives in Griffin

  10. RNN as a Classifier label = Neutral Quahog Peter lives in Griffin

  11. Recurrent Neural Network • เหมาะกับ Sequence Labeling ที่ต้องใช้บริบทกว้าง เช่น Language Modeling, NER, ตัดคํา • เหมาะกับการใช้เป็น classifier เพราะเก็บบริบทได้ครบ • ในทางปฏิบัติแล้ว train ลําบาก

  12. Training RNN

  13. Concept ที่สําคัญ • Backpropagation Through Time (BPTT) algorithm • Exploding gradient • Vanishing gradient

  14. Backpropagation Through Time

  15. Exploding Gradient

  16. Vanishing Gradient

  17. การเทรน RNN • RNN Parameter น้อย แต่ว่าเทรนลําบาก • Exploding gradient ทําให้ Loss เป็น NaN หรือ parameter แกว่ง มากในแต่ละ iteration --> Gradient Clipping • Vanishing gradient ทําให้ network ไม่เขยื้อน —> GRU, LSTM

  18. Gated Recurrent Unit (GRU) + Long Short-Term Memory (LSTM)

  19. RNN Cell c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) Peter

  20. RNN Cell c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) RNN Cell Peter

  21. (Simplified) Gated Recurrent Unit B-PER Γ u = σ ( W u ⋅ [ c t − 1 ; x t ] + b u ) c t = Γ u * ˜ c t + (1 − Γ u ) * c t − 1 c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) ˜ Peter

  22. (Simplified) Gated Recurrent Unit c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) ˜ Peter

  23. (Simplified) Gated Recurrent Unit Γ u = σ ( W u ⋅ [ c t − 1 ; x t ] + b u ) c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) ˜ Peter

  24. (Simplified) Gated Recurrent Unit B-PER Γ u = σ ( W u ⋅ [ c t − 1 ; x t ] + b u ) c t = Γ u * ˜ c t + (1 − Γ u ) * c t − 1 c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) ˜ Peter

  25. (Simplified) Gated Recurrent Unit B-PER Γ u = σ ( W u ⋅ [ c t − 1 ; x t ] + b u ) c t = Γ u * ˜ c t + (1 − Γ u ) * c t − 1 c t = tanh( W c ⋅ [ c t − 1 ; x t ] + b c ) ˜ Peter

  26. Gated Recurrent Unit B-PER c t c t − 1 GRU Cell Peter

  27. O O B-PER c 0 c 1 c 3 c 2 GRU Cell GRU Cell GRU Cell in lives Peter

  28. Long Short-Term Memory Unit B-PER h t − 1 h t LSTM Cell c t − 1 c t Peter

  29. O O B-PER c 0 c 1 c 3 c 2 LSTM Cell LSTM Cell LSTM Cell in lives Peter

  30. O B-LOC O I-PER B-PER Quahog Peter lives in Griffin

  31. O B-LOC O I-PER B-PER RNN Quahog Peter lives in Griffin

  32. Gated Recurrent Unit • RNN โดยทั่วไป เรียกว่า Vanilla RNN • GRU และ LSTM เป็น RNN แบบที่เทรนง่ายขึ้นเพราะ แก้ปัญหา Vanishing gradient ได้ดี แต่ parameter เยอะขึ้น

  33. Bidirectional RNN

  34. Bidirectional RNN • Bidirectional Gated Recurrent Unit (Bi-GRU) • Bidirectional Long Short-Term Memory (Bi-LSTM) • BiLSTM + CRF

  35. O B-LOC O y = label output I-PER B-PER h = hidden activation x = feature vector Quahog Peter lives in Griffin

  36. I-LOC O B-LOC O B-PER Island in Rhode lives Peter

  37. h t Island in Rhode lives Peter

  38. h t h t Island in Rhode lives Peter

  39. I-LOC O B-LOC O B-PER [ h t ; h t ] h t h t BI-LSTM / BI-GRU Island in Rhode lives Peter

  40. I-LOC O B-LOC O B-PER [ h t ; h t ] h t h t BI-LSTM-CRF Island in Rhode lives Peter

  41. Bi-LSTM-CRF in Practice

  42. Word Embedding vs Discrete Features - Discrete features เหมาะกับ CRF - Word embedding เหมาะกับ LSTM Huang, Zhiheng, Wei Xu, and Kai Yu. "Bidirectional LSTM-CRF models for sequence tagging." arXiv preprint arXiv:1508.01991 (2015).

  43. ควรใช้ Pre-trained Embedding Huang, Zhiheng, Wei Xu, and Kai Yu. "Bidirectional LSTM-CRF models for sequence tagging." arXiv preprint arXiv:1508.01991 (2015).

  44. Almost State-of-the-art POS tagging Huang, Zhiheng, Wei Xu, and Kai Yu. "Bidirectional LSTM-CRF models for sequence tagging." arXiv preprint arXiv:1508.01991 (2015).

  45. Almost State-of-the-art NER Huang, Zhiheng, Wei Xu, and Kai Yu. "Bidirectional LSTM-CRF models for sequence tagging." arXiv preprint arXiv:1508.01991 (2015).

  46. สรุปคือยังไง • Bi-LSTM-CRF เป็นโมเดลที่มีประสิทธิภาพ เทรนไม่ยากมาก และใช้กัน แพร่หลายตอนนี้ ( ปี 2020) • ควรจะใช้ pre-trained embedding + discrete features • ไม่แน่เสมอไปว่าจะดีกว่า CRF หรือแม้แต่ Maximum Entropy

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend