RNN - leemik3/tensorflow-2.0 GitHub Wiki
RNN (Recurrent Neural Network)
-
์๊ฐ์ ์ผ๋ก ์ฐ์์ฑ์ด ์๋ ๋ฐ์ดํฐ๋ฅผ ์ฒ๋ฆฌํ๋ ค๊ณ ๊ณ ์๋ ์ธ๊ณต ์ ๊ฒฝ๋ง
-
์ด์ ์๋์ธต์ด ํ์ฌ ์๋์ธต์ ์ ๋ ฅ์ด ๋๋ฉด์ ๋ฐ๋ณต๋๋ ์ํ ๊ตฌ์กฐ๋ฅผ ๊ฐ๋๋ค
-
๊ธฐ์กด ๋คํธ์ํฌ์ ๋ค๋ฅธ ์ ์ '๊ธฐ์ต์ ๊ฐ๋๋ค'๋ ๊ฒ
-
ํ์ฉ ๋ถ์ผ
- ์์ฐ์ด ์ฒ๋ฆฌ : ์์ฑ ์ธ์, ๋จ์ด ์๋ฏธ ํ๋จ ๋ฐ ๋ํ ๋ฑ ์ฒ๋ฆฌ
- ์๊ณ์ด ๋ฐ์ดํฐ ์ฒ๋ฆฌ
-
์ด๋ก ์ ์ผ๋ก๋ long sequence data๋ ์ฒ๋ฆฌํ ์ ์์ง๋ง, ์ค์ ๋ก๋ vanishing/exploding gradient problem์ผ๋ก ์ธํด ๋ช ๊ฐ์ step๋ง ๋ณผ ์ ์์ (long term dependency) -> ํด๊ฒฐ์ฑ : LSTM, GRU
RNN Lecture Note
- Reference
https://www.youtube.com/watch?v=bPRfnlG6dtU
[#26.Lec] (๊ฐ์ถ) Basic of RNN (Recurrent Neural Network) - ๋ฅ๋ฌ๋ ํ๋ก์๊ธฐ
Classical Approach for Time Series Analaysis
- Time domain analaysis
- Frequency domain analysis
- Nearest neighbors analysis
- Probabilistic Model : Language modeling (์ฃผ์ด์ง ์ํ์ค์ ๋ํด์ ๊ทธ ๋ค์์ ๋์ฌ ์ํ์ค๊ฐ ๋ญ์ง์ ๋ํ ํ๋ฅ ๋ชจ๋ธ๋ง)
- (S)AR(I)MA(X) models : time series์ autocorrelation
- Decomposition : Time series = trend part + seasonal part + residuals -> ๋ถํดํ๋ ๊ฒ
- Nonlinear Dynamics : (Ordinary / Partial / Stochastic) Differential Equation
- Machine Learning
Deep Learning Dealing with Sequential Data
MLP : stack of fully connected layers
- W matrix๊ฐ ๊ณ ์ ๋์ด ์์ โ ์์ ๊ธธ์ด์ sequence๋ฅผ ๋ค๋ฃจ๊ธฐ ํ๋ค๋ค.
- fixed length sequence ์ ๊ฒฝ์ฐ โ ๋ค์ํ ํํ์ผ๋ก ์ธํด ๋ง์ ํ๋ผ๋ฏธํฐ๋ฅผ ์ํจ.
CNN : stack of Conv, Pool, FC layers
- ์๊ณ์ด ๋ฐ์ดํฐ์ ๋ํด ์ฑ๋ฅ์ ์ ๋
RNN : Recurrent Neural Network
Sequential Data๋ ์์๊ฐ ์๋ฏธ๊ฐ ์๋ ๋ฐ์ดํฐ์! ์ด order์ ๊ณ ๋ คํ๊ธฐ ์ํด์ ์ด์ time step์ output๊ณผ ์๋ก์ด input์ ๊ฐ์ด ๊ณ ๋ คํ์ฌ ํ์ฌ step์ output์ ๋ง๋๋ ๊ฒ์ด๋ค.
x : ๊ฐ time step์ ๋ฐ์ดํฐ
p.s) ์ด์ time step์ output(h) + ์๋ก์ด input(x) ๊ฐ์ด ๊ณ ๋ คํ๋ ๋ฐฉ๋ฒ
h์ ํ๋ ฌ ์ฐ์ฐ(ํ๋ ๋ค๋ชจ ๋ถ๋ถ)์ ํ ๋ค์ ํ์ฌ input๊ณผ element-wiseํ๊ฒ ๋ํด์ค ๋ค nonlinear activation function ์ฐ์ฐ์ ์ํ
Q) h์ ์ฐ์ฐํ๋ ํ๋ ฌ์ ๊ฐ์ ํ๋ผ๋ฏธํฐ?
A) ใ ใ parameter sharing์ ํ๋ค
Q) ๋ค์ด์ค๋ ๋ฐ์ดํฐ์ ๊ธธ์ด๊ฐ ๋ค๋ฅด๋ค๋ฉด?
A) ์ ์๋๊ฒ ์ฃ ? interpolation ๋ฑ์ ๋ฐฉ๋ฒ์ผ๋ก ์ฒ๋ฆฌํ๋ค.
Q) ๋ฐ์ดํฐ๊ฐ ๋ฌธ์ฅ์ด๋ฉด ์ด๋ป๊ฒ ์ฒ๋ฆฌ? (x๊ฐ ๋ฌธ์ฅ์ธ ๊ฒฝ์ฐ์)
A) NLP์์ ๋ค๋ฃจ๋ ๋ฌธ์ ์ธ๋ฐ, ์ฃผ๋ก ํ๋ ๋ฐฉ๋ฒ์, ๋ฌธ์ฅ์ ๊ตฌ์ฑํ๋ ๋จ์ด์ ์งํฉ์ ๋ง๋ค๊ณ ๊ฐ token์ one-hot encoding
Output Y๋ฅผ ์ป๋ ๋ฐฉ๋ฒ

- many to one : ์ํ๋ ๋ถ๋ถ์ ๊ทธ๋ฅ model ํ๋๋ฅผ ๋ ๋ถ์ธ๋ค.
- many to many : ๋ง์ฐฌ๊ฐ์ง๋ก model(๋ ธ๋ ๋ค๋ชจ ๋ถ๋ถ)์ ๋ถ์, parameter๊ฐ share๋๊ธฐ ๋๋ฌธ์ ๋ ธ๋ model๋ค์ ํ๋ผ๋ฏธํฐ๊ฐ ๋ชจ๋ ๊ฐ์
Q) ๊ทธ๋ฆผ์ด ํ epoch์ธ๊ฐ์?
A) ์๋์ค. ํด๋น ๊ทธ๋ฆผ์ ํ๋์ ์ํ์ค์ ๋ํ ๊ทธ๋ฆผ. Batch๊ฐ 100๊ฐ๋ผ๋ฉด ํด๋น ๊ทธ๋ฆผ์ด 100๊ฐ ์๊ณ ๋ณ๋ ฌ์ ์ผ๋ก ์ํํ๋ค๊ณ ์๊ฐํ๋ฉด ๋จ.
RNN with Math
