RNN
功能
RNN遞歸神經網路,可以使NN有短暫的記憶功能,輸入測資的順序會影響輸出的結果。
- 輸入順序影響輸出結果,對於語句分析之類具有時效性應用有幫助。

實作
-
SimpleRNN
簡單的將Hidden Layer的輸出儲存到記憶體,下次運算時再加回輸入。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
原理
下圖中[1 1]為輸入,記憶體為[0 0],輸出為[1+1 1+1]=[2 2],
下次[1 1]為輸入,記憶體為[2 2],輸出為[1+1+2+2 1+1+2+2]=[6 6]。

bidirectional RNN
之前的RNN在做出判斷時並未完整看完句子,用bidirectional RNN可以確保做出判斷時已經看完整個句子。

-
Long Short-Term Memory (LSTM)
使用LSTM Unit,搭配數個控制閘來控制記憶與遺忘,藉此達到較長的短期記憶。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
原理
4個閘控制輸入,1個閘輸出。

sigmoid函數會將輸入映射到0~1,如果輸入過小,會完全關閉閥門,過大則會完全通過。

假設輸入為1個三維vector,此時會有4組weight和bios,將輸入乘上weight,加上bios,當作4個gate的輸入值。
初始的輸入為[3 1 0],此時Input Gate輸入為90,將會開啟,Forget Gate輸入為110,開啟,記憶變為3+1 * 0(原來的記憶) = 3,Output Gate輸入為-10,關閉,因此輸出是0。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
從上圖可以觀察到:
- 輸入weight為[1 0 0],代表輸入為
- Input Gate 的bios為-10,代表平常輸入閥是關閉的,只有帶正值時才會開啟。
- Forget Gate的bios為10,代表平常記憶會繼續保存,只有帶負值才會遺忘。
- Output Gate的bios為-10,代表平常輸出為關閉,只有帶正值時才會輸出。
-
Attention-based model
藉由控制讀寫頭,讓模型具有讀寫特定記憶的功能,可以仿照人類大腦,依據問題去使用特定的記憶。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
應用
- 語意分析
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- CTC語音辨識 : 辨識輸出不一定都是文字,延長音會輸出null。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- Seq-to-Seq Encoder: 將模型最後一層輸出當作輸入,由另一個RNN產生出原始語句。此時模型目的為完整還原原始句子,Loss Function為輸入與輸出語句的差別。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 應用 : 語言翻譯、語音辨識 (Encoder的部分不變,產生語意vector後再做不同用途。)