Recurrent Neural Networks

Examples of Sequence Data

  • Speech Recognition
  • Music Generation
  • Sentiment Classification
  • DNA Sequence Analysis
  • Machine Translation
  • Video Activity Recognition
  • Name Entity Recognition

Notation

SymbolMeaning
X(i)<t> X ( i ) < t > The t t th element in the input sequence for training example i
Y(i)<t> Y ( i ) < t > The t t th element in the output sequence for training example i
T(i)X T X ( i ) Input sequence length for training example i i
Ty(i)Output sequence length for training example i i

Recurrent Neural Network Model

Why not standard network?

  1. Inputs, outputs can be different lengths in different examples.
  2. Doesn’t share features across different features of text.

RNN Unit

a<t>=g(Waaa<t1>+Waxx<t>+ba)
y^<t>=g(Wyaa<t>+by) y ^ < t > = g ( W y a a < t > + b y )
Let Wa=(WaaWax),[a<t1>,x<t>]=(a<t1>x<t>),Wy=Wya, W a = ( W a a W a x ) , [ a < t − 1 > , x < t > ] = ( a < t − 1 > x < t > ) , W y = W y a , then
a<t>=g(Wa[a<t1>,x<t>]+ba) a < t > = g ( W a [ a < t − 1 > , x < t > ] + b a )
y^<t>=g(Wya<t>+by) y ^ < t > = g ( W y a < t > + b y )

Forward Propagation

Different Types of RNNs

TypeExample
Many-to-many, Tx=Ty T x = T y Name entity recognition
Many-to-oneSentiment classification
One-to-one
One-to-manyMusic generation
Many-to-many, TxTy T x ≠ T y Machine translation

1. Many-to-many, Tx=Ty T x = T y

2. Many-to-one

3. One-to-one

4. One-to-many

5. Many-to-many, TxTy T x ≠ T y

Gated Recurrent Unit (GRU)


c~<t>=tanh(Wc[Γrc<t1>,x<t>]+bc) c ~ < t > = tanh ⁡ ( W c [ Γ r ∗ c < t − 1 > , x < t > ] + b c )
Update Gate: Γu=σ(Wu[c<t1>,x<t>]+bu) Γ u = σ ( W u [ c < t − 1 > , x < t > ] + b u )
Relevant Gate: Γr=σ(Wr[c<t1>,x<t>]+br) Γ r = σ ( W r [ c < t − 1 > , x < t > ] + b r )
Memory cell value: c<t>=Γuc~<t>+(1Γu)c<t1> c < t > = Γ u ∗ c ~ < t > + ( 1 − Γ u ) ∗ c < t − 1 >
a<t>=c<t> a < t > = c < t >

Long Short Term Memory (LSTM)


c~<t>=tanh(Wc[a<t1>,x<t>]+bc) c ~ < t > = tanh ⁡ ( W c [ a < t − 1 > , x < t > ] + b c )
Update Gate: Γu=σ(Wu[a<t1>,x<t>]+bu) Γ u = σ ( W u [ a < t − 1 > , x < t > ] + b u )
Forget Gate: Γf=σ(Wf[a<t1>,x<t>]+bf) Γ f = σ ( W f [ a < t − 1 > , x < t > ] + b f )
Output Gate: Γo=σ(Wo[a<t1>,x<t>]+bo) Γ o = σ ( W o [ a < t − 1 > , x < t > ] + b o )
Memory Cell: c<t>=Γuc~<t>+Γfc<t1> c < t > = Γ u ∗ c ~ < t > + Γ f ∗ c < t − 1 >
a<t>=Γotanhc<t> a < t > = Γ o ∗ tanh ⁡ c < t >

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值