长短时记忆神经网络(LSTM-2)
1. 网络结构
2. 输出前向传播
前向传播公式定义如下:
(1)
根据 LSTM 结构图定义可得:
(2)
1
otoctoxtohtogtgxtghtgitictixtihtiftfctfxtfhtfbcwxwhwnetbxwhwnetbcwxwhwnetbcwxwhwnet1,1,11,11,)()()()()(1,,,,tttttttttottgttittftctanhohgicfcnetsigmonettanhgnetsigminetsigmf1th1tctcthtanhtxtftotitgtanhtcttgi1ttcf)(ttctanhosigmtcsigm1tcsigm
3. 误差反向传递
t 时刻的误差 定义:
(3)
由公式(1)(2)可知
都是 的函数,根据误差定义及全
导数公式可得:
(4) 各单元 t 时刻误差
公式计算:
其中
只要求出 即可,因为
都是
的函数,根据全导数公式可得:
由于上式出现了 t+1,所以当
时前三项不存存在。
将公式(4)循环代入
可求出各时刻的误差。
2
lt),0[,,111TthETtltlttltltlttotgtitfnetnetnetnet,,,,,,,1th w w w w hnetnetEhnetnetEhnetnetE hnetnetEohtoghtgihtifhtfltttotottgtgttitittftfltt,,,,111,,1,,1,,1,,111totgtitf ,,,,,,, g i netggccEnetE ii g netiiccEnetE ff c netffccEnetE oo )ctanh( netoohhEnetEtttctgtttttgtgttttctitttttitittttctftttttftftttttotttttoto)1()1()1()1(2,,,,,,,,1,,,,,,,tgtitf ,,,,, tc,ttottitfhnetcnetnet,,,,,11,1,tc )ctanh(o wfww chhEcnetnetE cccE cnetnetE cnetnetEcE2tttoctottcictifctftttttototttttitittftfttc)1(,1,1,1,,,111,1,1,1,,Tt w w w wohtoghtgihtifhtfltt,,,,111
4. 权重及偏置更新
(5)
根据各时刻的误差
计算权重及偏置梯度如下:
5. 误差向上层传递
LSTM 网络当前层为 ,定义
层的误差项为:
(6)
LSTM 的输入 是上一层的网络输出,定义为
,其中 为
层的激活函数。由公式(1)的定义可知,
均为 的函数,
根据全导数公式可得:
王伟东
532873584@qq.com
2018-02-25
3
bEbbbbwEwwwwtotgtitf ,,,,,,,TttooTttggTttiiTttffTtttoocTtttiicTtttffcTtttooxTtttggxTtttiixTtttffxTtttoohTtttgghTtttiihTtttffhb , b , b , b cw , cw , cwxw , xw , xw , xwhw , hw , hw , hw1,1,1,1,1,11,11,1,1,1,1,11,11,11,11,l1l11ltltnetEltx)(11ltlltnetfx1lf1lltoltgltiltfnetnetnetnet,,,,,,,ltx )(netf w w w w netx xnetnetE netx xnetnetE netx xnetnetE netx xnetnetE 1-lt' oxtogxtgixtifxtfltltltltoltoltltltltgltgltltltltiltiltltltltfltflt)(,,,,1,,1,,1,,1,,1