CS224N Natural Language Processing with Deep Learning Lecture 7
课程主页:https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/
视频地址:https://www.bilibili.com/video/av46216519?from=search&seid=13229282510647565239
这里回顾CS224N Lecture 7的课程内容,这一讲介绍了梯度消失以及梯度爆炸的问题,GRU以及LSTM。
Vanishing Gradient and Gradient Explosion Problems回顾梯度计算公式
\frac{\partial E}{\partial W}=\sum_{t=1}^{T} \frac{\partial E_{t}}{\partial W}由链式法则不难得到
\frac{\partial E_{t}}{\partial W}=\sum_{k=1}^{t} \frac{\partial E_{t}}{\partial y_{t}} \frac{\partial y_{t}}{\partial h_{t}} \frac{\parti ...
Michael Collins NLP Homework 1
课程主页:http://www.cs.columbia.edu/~cs4705/
课程网盘地址:
链接:https://pan.baidu.com/s/1KijgO7yjL_MVCC9zKZ7Jdg提取码:t1i3
整理资料的时候发现拖欠了很多课程,后续会一一完成,这一次先回顾Michael Collins NLP作业1。
Quesion 1假设句子$S_i$的长度为$|S_i|$,记
M= \sum_{i=1}^n |S_i|考虑如下量
\begin{aligned}
\ell &= \frac 1 M \sum_{i=1}^n\log_2 p(S_i)\\
&=\frac 1 M \sum_{i=1}^n \sum_{j=1}^{|S_i|} \log_2 q(w_j|w_{j-2},w_{j-1})\\
&= \frac 1 {M} \sum_{w_{1}, w_{2}, w_{3}} \mathrm{c}^{\prime}\left(w_{1}, w_{2}, w_{3}\right) \log_2 q\left(w_{3}, | w_{1}, w_{2}\righ ...
CS236 Deep Generative Models Homework 1
课程主页:https://deepgenerativemodels.github.io/
课件资料:https://github.com/Subhajit135/CS236_DGM,https://github.com/deepgenerativemodels/notes
视频地址:https://www.bilibili.com/video/av81625948?from=search&seid=4636291486683332935
这里回顾CS236 Homework 1。
Problem 1证明:
\begin{aligned}
\mathbb{E}_{\hat{p}(x)}\left[D_{\mathrm{KL} }\left(\hat{p}(y | x) \| p_{\theta}(y | x)\right)\right]
&=\mathbb{E}_{\hat{p}(x)}\left[\mathbb{E}_{\hat{p}(y|x)}[\log \hat{p}(y|x)-\log {p}_{\theta}(y|x)] \right]\\
&= \sum_x \ ...
CS224N Natural Language Processing with Deep Learning Assignment 3
课程主页:https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/
视频地址:https://www.bilibili.com/video/av46216519?from=search&seid=13229282510647565239
这里回顾CS224N Assignment 3的内容,参考资料如下:
https://github.com/ZacBi/CS224n-2019-solutions
1.Machine Learning & Neural Networks(a)(i)
该更新方式实际上计算了梯度的加权和,所以不会变化太大;低方差可以减少震荡的情形。
(ii)
梯度小的地方会得到更大的更新,梯度大的地方会得到更小的更新,该方法使得各个方向的更新幅度比较接近,可以减少震荡的情形。
(b)(i)
\begin{aligned}
\mathbb{E}_{p_{\text {drop }}}\left[\mathbf{h}_{\text {drop}}\right]_{i}
&=\gamma (1 ...
CS224N Natural Language Processing with Deep Learning Lecture 6
课程主页:https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/
视频地址:https://www.bilibili.com/video/av46216519?from=search&seid=13229282510647565239
这里回顾CS224N Lecture 6的课程内容,这一讲介绍了RNN。
Language Models考虑语言模型,即计算一个句子的概率,利用链式法则可得
P\left(w_{1}, \ldots, w_{m}\right)=\prod_{i=1}^{i-m} P\left(w_{i} | w_{1}, \ldots, w_{i-1}\right)后续讨论两个经典模型,分别是n-gram和RNN。
n-gram Language Modelsn-gram是使用$n$阶马尔可夫条件,即每个单词只依赖于前$n$个单词,那么一个句子的概率为
P\left(w_{1}, \ldots, w_{m}\right)=\prod_{i=1}^{i-m} P\left(w_{i} | w ...
CS236 Deep Generative Models Lecture 6
课程主页:https://deepgenerativemodels.github.io/
课件资料:https://github.com/Subhajit135/CS236_DGM,https://github.com/deepgenerativemodels/notes
视频地址:https://www.bilibili.com/video/av81625948?from=search&seid=4636291486683332935
这里回顾CS236 Lecture 6的课程内容,这一讲介绍了EM算法以及ELBO。
Partially observed data假设我们有联合分布
p(\mathbf{X}, \mathbf{Z} ; \theta)$\mathbf X$为可观测变量,$\mathbf Z$为不可观测变量,数据集为$\mathcal{D}=\left\{\mathbf{x}^{(1)}, \cdots, \mathbf{x}^{(M)}\right\}$,那么数据的对数似然为
\begin{aligned}
\ell(\theta ; \mathcal ...
CS236 Deep Generative Models Lecture 5
课程主页:https://deepgenerativemodels.github.io/
课件资料:https://github.com/Subhajit135/CS236_DGM,https://github.com/deepgenerativemodels/notes
视频地址:https://www.bilibili.com/video/av81625948?from=search&seid=4636291486683332935
这里回顾CS236 Lecture 5的课程内容,这一讲介绍了隐变量模型。
Main idea in Monte Carlo Estimation假设我们想计算期望
E_{x \sim P}[g(x)]=\sum_{x} g(x) P(x)如果直接计算很困难,那么可以使用蒙特卡洛模拟的思路进行计算上述值:从分布$P$中采样$x^{1}, \ldots, x^{T}$,然后利用下值近似上述期望
\hat{g}\left(\mathbf{x}^{1}, \cdots, \mathbf{x}^{T}\right) \triangleq \fra ...
CS224N Natural Language Processing with Deep Learning Lecture 5
课程主页:https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/
视频地址:https://www.bilibili.com/video/av46216519?from=search&seid=13229282510647565239
这里回顾CS224N Lecture 5的课程内容,这一讲介绍了Dependency Parsing。
Dependency Parsing句子的依赖结构(dependency structure)展示了句子中的单词依赖于其他哪个单词,通常会增加一个根节点ROOT,此外依赖结构还有如下限制:
只有一个单词依赖于ROOT
没有循环
上述条件会使得dependency变成树结构,一个具体的例子如下:
转换成树的形式效果如下:
Greedy Deterministic Transition-Based Parsing现在讨论如何解析句子的依赖结构,首先介绍Greedy Deterministic Transition-Based Parsing,该方法是使用状态转移的方法进行 ...
Deep Learning for Human Language Processing Part 1(P1 to P2)
课程主页:http://speech.ee.ntu.edu.tw/~tlkagk/courses_DLHLP20.html
视频地址:https://www.bilibili.com/video/BV1RE411g7rQ?p=1
参考资料:https://blog.csdn.net/qq_44574333/category_10304412_2.html
备注:图片均来自于课件。
这里回顾李宏毅老师的课程Deep Learning for Human Language Processing P1至P2,这部分主要介绍了课程内容。
课程内容简介课程的名称为深度学习与人类语言处理,主要介绍了深度学习在文本与语音领域的应用,主要内容可以由下图概括:
具体来说,一共有如下六种模式:
输入:语音;输出:文本
输入:文本;输出:语音
输入:语音;输出:语音
输入:文本;输出:文本
输入:语音;输出:类别
输入:文本;输出:类别
第一种模式的典型例子是语音识别,第二种模式的典型例子是文字转语音合成,第三种模式的典型例子有语音分离和语音转换:
第四种模式的典型例子有机器翻译,聊天机器人等等 ...
CS224N Natural Language Processing with Deep Learning Assignment 2
课程主页:https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/
视频地址:https://www.bilibili.com/video/av46216519?from=search&seid=13229282510647565239
这里回顾CS224N Assignment 2的内容,Assignment 1比较基础,这里从略。
1.Understanding word2vec(a)注意只有当$w= o$时,我们才有$y_w =1$,其余情形均为$0$,所以
-\sum_{w \in V o c a b} y_{w} \log \left(\hat{y}_{w}\right)=-\log \left(\hat{y}_{o}\right)(b)
\begin{aligned}
J_{\text {naive-softmax} }\left(\boldsymbol{v}_{c}, o, \boldsymbol{U}\right)
&=-\log P(O=o | C=c) \\
&= -\log \frac{ ...
CS236 Deep Generative Models Lecture 4
课程主页:https://deepgenerativemodels.github.io/
课件资料:https://github.com/Subhajit135/CS236_DGM,https://github.com/deepgenerativemodels/notes
视频地址:https://www.bilibili.com/video/av81625948?from=search&seid=4636291486683332935
这里回顾CS236 Lecture 4的课程内容,这一讲介绍了自回归模型以及KL散度。
RNN: Recursive Neural Nets在模型$p\left(x_{t} | x_{1: t-1} ; \boldsymbol{\alpha}^{t}\right)$中,历史$x_{1:t-1}$会越来越长,这样会产生内存和计算上的负担,解决该问题的思想是对之前的历史进行总结然后递归的更新它,根据该思想产生了RNN,其结构如下:
\begin{aligned}
\text{Summary update rule}: h_{t+1}&=\ta ...
CS236 Deep Generative Models Lecture 3
课程主页:https://deepgenerativemodels.github.io/
课件资料:https://github.com/Subhajit135/CS236_DGM,https://github.com/deepgenerativemodels/notes
视频地址:https://www.bilibili.com/video/av81625948?from=search&seid=4636291486683332935
这里回顾CS236 Lecture 3的课程内容,这一讲介绍了自回归模型。
Autoregressive Models例子:MNIST考虑MNIST数据集$\mathcal D$:
每个图片有$n=28 \times 28 =784$个像素,每个像素为$0$或$1$。我们希望学习一个概率分布$p(v)=p\left(v_{1}, \cdots, v_{784}\right)$,其中$v \in\{0,1\}^{784}$;该概率分布应该有如下效果:如果$v \sim p(v)$,那么$v$看起来像数字。具体思路是定义模型族$\left\{p ...