LSTM 学习

〇、总则

基于李宏毅2017机器学习课程

Multiple-layer LSTM Structure

回顾RNN的结构

alt text

Long short-term memory结构如下:We can see that 同等数量units 参数量是RNN的4倍(一个很重要的点)

alt text

LSTM网络则是将每一个隐藏层单元替换为一个LSTM unit。
多层LSTM网络结构如下:除了**输入序列$x^t$隐藏层输出$h^{t-1}$**,使用Extension “peephole”,memory cell输出$c^{t-1}$ 也作为下一时刻的输入

alt text

训练

BPTT(backpropagation through time),考虑时间信息

alt text

RNN traning比较困难,容易梯度爆炸:

alt text

避免梯度爆炸的technique:当梯度大于15时截断(发明人的方法)



一、实现

1

二、应用

1
2
3
4
5
class GridCellsRNNCell(snt.RNNCore):
def __init__(self,target_ensembles,nh_lstm,nh_bottleneck,nh_embed=None,...
dropoutrates_bottleneck=None):


batch size的影响

loss function is across entropy:

$$-\sum_i^{\mathrm{NPC}} P(y_i)\log P(\hat y_i)-\sum_j^{\mathrm{NHDC}} P(z_j)\log P(\hat z_j)$$

NPC=256, NHDC=32. This will cause loss pc


LSTM 学习
https://liu-alessia.github.io/2026/01/21/2026-01-12-LSTM学习/
作者
Alessia
发布于
2026年1月22日
许可协议