π reference link
Summary !
π (μ
λ ₯κ°, μ§μ κΉμ§ κ³μ°λ νλ 벑ν°)λ₯Ό κΈ°λ°μΌλ‘,
κ°λ³ λλ μμ°¨ λ°μ΄ν°λ₯Ό μ²λ¦¬νμ¬ μμΈ‘μ μννλ "μ¬κ·μ " λͺ¨λΈ
Sequence data
Recursive
Β
1. RNN model structure π
βThe same function and set of parameters are used at every time step.β
- κ° λ¨κ³λ§λ€ λμΌν λͺ¨λ Aκ° μ¬κ·μ μΌλ‘ νΈμΆλλ©°, μ΄μ μ€ν
μ μΆλ ₯μ΄ λ€μ μ€ν
μ μ
λ ₯μΌλ‘ μ¬μ©λλ€.
- N-1 step's output β N step's input
Β
RNN Function & Parameters
RNNμ κΈ°λ³Έ ν¨μλ λ€μκ³Ό κ°μΌλ©°, μ΄λ₯Ό ν΅ν΄ 맀 μ€ν
λ§λ€ hidden state hκ° κ°±μ λλ€.
htβ=fwβ(htβ1β,xtβ)
xtβ : νμ¬ μ€ν
(t)μμμ Input data
htβ1β : μ§μ μ€ν
(tβ1)κΉμ§ κ³μ°λ Hidden-state vector
htβ : Hidden-state vector output
at t
-
fwβ : RNN function
, tμμμ Hidden state vector (htβ)λ₯Ό μΆλ ₯νλ€.
- w : Linear transformation matrix β μ ν λ³ν μν
-
ytβ : Output
vector at t, based on htβ
Β
Hidden state vector (htβ) μ°μ°
htβ=fWβ(htβ1β,xtβ)
κ°μ
:
νμ t , μ
λ ₯ λ²‘ν° xtβμ μ΄μ νμμ€ν
μ μΆλ ₯ λ²‘ν° htβ1βμ ν¬κΈ°λ₯Ό κ°κ°
-
xtβΒ [3Β XΒ 1],Β htβ1βΒ [2Β XΒ 1] λΌκ³ κ°μ νλ©΄,
-
FC layerμ μ ν λ³ν matrix Wλ, WΒ [2Β XΒ 5] μμ μ μ μλ€.
(htβμ ν¬κΈ° μμ htβ1βμ λμΌνκ² μ μ§λμ΄μΌ νκΈ° λλ¬Έ)
htβ=tanh(Whhβhtβ1βΒ +Β Wxhβxtβ)ytβ=Whyβhtβ
μ°μ° κ³Όμ
:
xtβ,htβ1βμ Wμ λ΄μ μ κ±°μΉλ€. μ΄λ,
-
Matrix Wμ μ’μΈ‘ Wxhβ[2Β XΒ 3]μ, xtβ 벑ν°μλ§ κ³μ°λλ€.
-
λ§μ°¬κ°μ§λ‘, Matrix Wμ μ°μΈ‘ Whhβ[2Β XΒ 2]μ, htβ1β 벑ν°μλ§ κ³μ°λλ€.
μ¦, Wxhβ:xtββhtβ,Β Whhβ:htβ1ββhtβμΌλ‘, λ³νμ μννλ€.
μ΄ν taskμ λ°λΌ μΆκ°μ μΈ Output layerμ μ ν λ³ν Matrix Whyβ μ κ³±νμ¬ - μ΅μ’
Ouput ytβκ° μΆλ ₯λλ€.
- λ§μ°¬κ°μ§λ‘, Whyβ:htββytβ μ λ³νμ μννλ€.
- ytβμ νμ©
- Binary classification : ytβ (1μ°¨μ, μ€μΉΌλΌκ°) β sigmoid func β νλ₯ κ°
- Multi-class classification : ytβ (class μ λ§νΌμ μ°¨μμ κ°μ§λ 벑ν°) β softmax β νλ₯ λΆν¬
Β
Β
2. λ€μν RNN models β°
Many or One ?
: νμ€ν¬μ λ°μ΄ν°μ λ§λ κ΅¬μ‘°λ‘ μ‘°ν©νμ¬ μ΄μ©νλ€.
Many <- Sequential data
< 5 differenct models from RNN >
1. One to One
- μ
λ ₯, μΆλ ₯μ νμμ€ν
= 1
- Sequence data X
- (ν€, λͺΈλ¬΄κ², λμ΄) β μ νμ, κ³ νμ λΆλ₯
2. One to Many
- μ
λ ₯λ§ νλμ νμμ€ν
- λ€μ μ€ν
μ μ
λ ₯μ΄ μλ κ²½μ°, λμΌ ν¬κΈ°μ 0 κ°μ input
- Image captioning task (1 img β sequential words)
3. Many to One
- μΆλ ₯λ§ νλμ νμ
μ€ν
- 맀 νμμ€ν
μ Sequential data input, λ§μ§λ§ μ€ν
μ output
- Sentiment classification (sequential words β pos / neg)
4. Many to Many (1)
- μ
λ ₯, μΆλ ₯ λ°μ΄ν°κ° λͺ¨λ μ°μμ
- μ
λ ₯ λ°μ΄ν°λ₯Ό λͺ¨λ λ°μ ν, μΆλ ₯ λ°μ΄ν° μμ±
- Machine translation
5. **Many** to **Many** (2)
- μ
λ ₯, μΆλ ₯ λ°μ΄ν°κ° λͺ¨λ μ°μμ
- μ
λ ₯μ΄ μ£Όμ΄μ§λ 맀 νμμ€ν
λ§λ€ μμΈ‘ μΆλ ₯μ μν
- μ€μκ°μ± μꡬ task : video classification - frame level
- λ¨μ΄λ³ λ¬Έμ₯μ±λΆ μμΈ‘!