【一】 Long Short Term Memory Network(长短期记忆)
通过三个门,遗忘门,输入门,输出门,控制信息的流动,解决梯度消失问题
【二】 Forget / Input / Output Gate(3个门)
- Forget Gate(遗忘门,0~1)
f(t)=σ(wf⋅h(t−1)+uf⋅xt+bf)−−(wf,uf,bf)
- Input Gate(输入门,0~1)
i(t)=σ(wi⋅h(t−1)+ui⋅xt+bi)−−(wi,ui,bi)
- Ouput Gate(输出门,0~1)
o(t)=σ(wo⋅h(t−1)+uo⋅xt+bo)−−(wo,uo,bo)
- Extra Information(在
t 时刻额外得到的信息)
c~(t)=tanh(wc⋅h(t−1)+uc⋅xt+bc)−−(wc,uc,bc)
- Final Information(在
t 时刻最终的信息,
∘ 表示向量相乘)
c(t)=f(t)∘c(t−1)+i(t)∘c~(t)
- Final hidden layer(通过那些信息计算
ht)
ht=o(t)∘tanh(c(t−1))
【三】 LSTM 应用场景
【四】 Bi-LSTM(双向 LSTM)
【五】 RNN · LSTM · Bi-LSTM - 对比
【六】 GRU - Gate Recurrent Unit
- Update Gate(更新门):在
t 时刻会有新的数据,从该信息中心抽取多少的信息,放到
ht 里面
u(t)=σ(wu⋅h(t−1)+uu⋅xt+bu)−−(wu,uu,bu)
- Reset Gate(重置门):和 LSTM 的 Forget Gate 类似,忘记或保留多少旧的信息
r(t)=σ(wr⋅h(t−1)+ur⋅xt+br)−−(wr,ur,br)
- Extra Information(在
t 时刻额外得到的信息)
c~(t)=tanh(wc⋅(r(t)∘h(t−1))+uc⋅xt+bc)−−(wc,uc,bc)
- Final hidden layer(通过那些信息计算
ht)
ht=(1−u(t))∘h(t−1)+u(t)∘c~(t)