cs224n-第9课(GRU-LSTM)

  • 1 GRU (Gated Recurrent Unit)
    cs224n-第9课(GRU-LSTM)
    更新门(update gate):
    zt=δ(W(z)xt+U(z)ht1)z_t=\delta(W^{(z)}x_t+U^{(z)}h_{t-1})
    重置门(reset gate):
    rz=δ(W(r)xt+U(r)ht1)r_z=\delta(W^{(r)}x_t+U^{(r)}h_{t-1})
    记忆门(new memory state):
    ht^=tanh(Wxt+rtUht1)\hat{h_t}=tanh(Wx_t+r_t\circ Uh_{t-1})
    Final Hidden State:
    ht=ztht1+(1zt)ht^h_t=z_t\circ h_{t-1}+(1-z_t)\circ \hat{h_t}

  • 2 LSTM (long short term memories)
    cs224n-第9课(GRU-LSTM)
    输入门(input gate):
    it=δ(W(i)xt+U(i)ht1)i_t=\delta(W^{(i)}x_t+U^{(i)}h_{t-1})
    遗忘门(forget gate):
    ft=δ(W(f)xt+U(f)ht1)f_t=\delta(W^{(f)}x_t+U^{(f)}h_{t-1})
    输出门(output gate):
    ot=δ(W(o)xt+U(o)ht1)o_t =\delta(W^{(o)}x_t+U^{(o)}h_{t-1})
    记忆门(new memory cell):
    ct^=tanh(W(c)xt+U(c)ht1)\hat{c_t}=tanh(W^{(c)}x_t+U^{(c)}h_{t-1})
    最终记忆门(final memory cell):
    ct=ftct1+itct^c_t=f_t\circ c_{t-1}+i_t\circ \hat{c_t}
    最终输出:
    ht=ottanh(ct)h_t=o_t\circ tanh(c_t)