【中英】【吴恩达课后测验】Course 5 - 序列模型 - 第一周测验
【中英】【吴恩达课后测验】Course 5 -序列模型 - 第一周测验 - 循环神经网络
上一篇:【课程4 - 第四周编程作业】※※※※※ 【回到目录】※※※※※下一篇:【待撰写-课程5 -第一周编程作业】
- 假设你的训练样本是句子(单词序列),下面哪个选项指的是第\(i\)个训练样本中的第\(j\)个词?
【★】 \(x^{(i)<j>}\)
【 】 \(x^{<i>(j)}\)
【 】 \(x^{(j)<i>}\)
【 】 \(x^{<j>(i)}\)
We index into the \(i^{th}\) row first to get the \(i^{th}\) training example (represented by parentheses), then the \(j^{th}\) column to get the \(j^{th}\) word (represented by the brackets).
首先获取第\(i\)个训练样本(用括号表示),然后到 \(j\)列获取单词(用括尖括号表示)。
- 看一下下面的这个循环神经网络:
在下面的条件中,满足上图中的网络结构的参数是:
【★】 \(T_x = T_y\)
【 】 \(T_x < T_y\)
【 】 \(T_x > T_y\)
【 】 \(T_x = 1\)
It is appropriate when every input should be matched to an output.
上图中每一个输入都与输出相匹配。
- 这些任务中的哪一个会使用多对一的RNN体系结构?
【 】 语音识别(输入语音,输出文本)。
【★】 情感分类(输入一段文字,输出0或1表示正面或者负面的情绪)。
【 】 图像分类(输入一张图片,输出对应的标签)。
【★】 人声性别识别(输入语音,输出说话人的性别)。
- 假设你现在正在训练下面这个RNN的语言模型:
在\(t\)时,这个RNN在做什么?
【 】 计算 \(P(y^{<1>}, y^{<2>}, …, y^{<t-1>})\)
【 】 计算 \(P(y^{<t>})\)
【★】 计算 \(P(y^{<t>} \mid y^{<1>}, y^{<2>}, …, y^{<t-1>})\)
【 】 计算 \(P(y^{<t>} \mid y^{<1>}, y^{<2>}, …, y^{<t>})\)
Yes,in a language model we try to predict the next step based on the knowledge of all prior steps.
是的,这个语言模型正在试着根据前面所有的知识来预测下一步。
- 你已经完成了一个语言模型RNN的训练,并用它来对句子进行随机取样,如下图:
在每个时间步\(t\)都在做什么?
【 】 (1)使用RNN输出的概率,选择该时间步的最高概率单词作为\(\hat{y}^{<t>}\),(2)然后将训练集中的正确的单词传递到下一个时间步。
【 】 (i)使用由RNN输出的概率将该时间步的所选单词进行随机采样作为 \(\hat{y}^{<t>}\),(2)然后将训练集中的实际单词传递到下一个时间步。
【 】 (1)使用由RNN输出的概率来选择该时间步的最高概率词作为 \(\hat{y}^{<t>}\),(2)然后将该选择的词传递给下一个时间步。
【★】 (1)使用RNN该时间步输出的概率对单词随机抽样的结果作为\(\hat{y}^{<t>}\),(2)然后将此选定单词传递给下一个时间步。
- 你正在训练一个RNN网络,你发现你的权重与激活值都是“NaN”,下列选项中,哪一个是导致这个问题的最有可能的原因?
【 】 梯度消失。
【★】 梯度爆炸。
【 】 ReLU函数作为激活函数g(.),在计算g(z)时,z的数值过大了。
【 】 Sigmoid函数作为激活函数g(.),在计算g(z)时,z的数值过大了。
- 假设你正在训练一个LSTM网络,你有一个10,000词的词汇表,并且使用一个激活值维度为100的LSTM块,在每一个时间步中,\(\Gamma_{u}\)的维度是多少?
【 】 1
【★】 100
【 】300
【 】 10000
Correct, \(\Gamma_u\) is a vector of dimension equal to the number of hidden units in the LSTM.
\(\Gamma_u\)的向量维度等于LSTM中隐藏单元的数量。
- 这里有一些GRU的更新方程:
爱丽丝建议通过移除 \(\Gamma_u\)来简化GRU,即设置\(\Gamma_u\)=1。贝蒂提出通过移除\(\Gamma_r\)来简化GRU,即设置\(\Gamma_r\)=1。哪种模型更容易在梯度不消失问题的情况下训练,即使在很长的输入序列上也可以进行训练?
【 】 爱丽丝的模型(即移除\(\Gamma_u\)),因为对于一个时间步而言,如果\(\Gamma_r \approx 0\),梯度可以通过时间步反向传播而不会衰减。
【 】 爱丽丝的模型(即移除\(\Gamma_u\)),因为对于一个时间步而言,如果\(\Gamma_r \approx 1\),梯度可以通过时间步反向传播而不会衰减。
【★】 贝蒂的模型(即移除\(\Gamma_r\)),因为对于一个时间步而言,如果\(\Gamma_u \approx 0\),梯度可以通过时间步反向传播而不会衰减。
【 】 贝蒂的模型(即移除\(\Gamma_r\)),因为对于一个时间步而言,如果\(\Gamma_u \approx 1\),梯度可以通过时间步反向传播而不会衰减。
For the signal to backpropagate without vanishing, we need \(c^{<t>}\) to be highly dependant on \(c^{<t-1>}\)
要使信号反向传播而不消失,我们需要 \(c^{<t>}\)高度依赖于\(c^{<t-1>}\)。
- 这里有一些GRU和LSTM的方程:
从这些我们可以看到,在LSTM中的更新门和遗忘门在GRU中扮演类似 \(\underline{\quad \quad}\)与\(\underline{\quad \quad}\)的角色,空白处应该填什么?
【★】 \(\Gamma_u\) 与 1−\(\Gamma_u\)
【 】 \(\Gamma_u\) 与 \(\Gamma_r\)
【 】 1−\(\Gamma_u\) 与 \(\Gamma_u\)
【 】 \(\Gamma_r\) 与 $ \Gamma_u$
- 你有一只宠物狗,它的心情很大程度上取决于当前和过去几天的天气。你已经收集了过去365天的天气数据\(x^{<1>}, …, x^{<365>}\),这些数据是一个序列,你还收集了你的狗心情的数据\(y^{<1>}, …, y^{<365>}\),你想建立一个模型来从x到y进行映射,你应该使用单向RNN还是双向RNN来解决这个问题?
【 】 双向RNN,因为在\(t\)日的情绪预测中可以考虑到更多的信息。
【 】 双向RNN,因为这允许反向传播计算中有更精确的梯度。
【★】 单向RNN,因为\(y^{<t>}\)的值仅依赖于\(x^{<1>}, …, x^{<t>}\),而不依赖于\(x^{<t+1>}, …, x^{<365>}\)。
【 】 单向RNN,因为\(y^{<t>}\)的值只取决于\(x^{<t>}\),而不是其他天的天气。
Recurrent Neural Networks
- Suppose your training examples are sentences (sequences of words). Which of the following refers to the jth word in the ith training example?
- \(x^{(i)<j>}\)
- \(x^{<i>(j)}\)
- \(x^{(j)<i>}\)
- \(x^{<j>(i)}\)
We index into the \(i^{th}\) row first to get the \(i^{th}\) training example (represented by parentheses), then the \(j^{th}\) column to get the \(j^{th}\) word (represented by the brackets).
- Consider this RNN:
This specific type of architecture is appropriate when:
- \(T_x = T_y\)
- \(T_x < T_y\)
- \(T_x > T_y\)
- \(T_x = 1\)
It is appropriate when every input should be matched to an output.
- To which of these tasks would you apply a many-to-one RNN architecture? (Check all that apply).
- peech recognition (input an audio clip and output a transcript)
- Sentiment classification (input a piece of text and output a 0/1 to denote positive or negative sentiment)
- Image classification (input an image and output a label)
- Gender recognition from speech (input an audio clip and output a label indicating the speaker’s gender)
- You are training this RNN language model.
At the \(t^{th}\) time step, what is the RNN doing? Choose the best answer.
- Estimating \(P(y^{<1>}, y^{<2>}, …, y^{<t-1>})\)
- Estimating \(P(y^{<t>})\)
- Estimating \(P(y^{<t>} \mid y^{<1>}, y^{<2>}, …, y^{<t-1>})\)
- Estimating \(P(y^{<t>} \mid y^{<1>}, y^{<2>}, …, y^{<t>})\)
Yes,in a language model we try to predict the next step based on the knowledge of all prior steps.
- You have finished training a language model RNN and are using it to sample random sentences, as follows:

What are you doing at each time step t?
- (i) Use the probabilities output by the RNN to pick the highest probability word for that time-step as \(\hat{y}^{<t>}\). (ii) Then pass the ground-truth word from the training set to the next time-step.
- (i) Use the probabilities output by the RNN to randomly sample a chosen word for that time-step as \(\hat{y}^{<t>}\). (ii) Then pass the ground-truth word from the training set to the next time-step.
- (i) Use the probabilities output by the RNN to pick the highest probability word for that time-step as \(\hat{y}^{<t>}\). (ii) Then pass this selected word to the next time-step.
- (i) Use the probabilities output by the RNN to randomly sample a chosen word for that time-step as \(\hat{y}^{<t>}\). (ii) Then pass this selected word to the next time-step.
- You are training an RNN, and find that your weights and activations are all taking on the value of NaN (“Not a Number”). Which of these is the most likely cause of this problem?
- Vanishing gradient problem.
- Exploding gradient problem.
- ReLU activation function g(.) used to compute g(z), where z is too large.
- Sigmoid activation function g(.) used to compute g(z), where z is too large.
- Suppose you are training a LSTM. You have a 10000 word vocabulary, and are using an LSTM with 100-dimensional activations a. What is the dimension of Γu at each time step?
- 1
- 100
- 300
- 10000
Correct, \(\Gamma_u\) is a vector of dimension equal to the number of hidden units in the LSTM.
- Here’re the update equations for the GRU.
Alice proposes to simplify the GRU by always removing the \(\Gamma_u\). I.e., setting \(\Gamma_u\) = 1. Betty proposes to simplify the GRU by removing the \(\Gamma_r\). I. e., setting \(\Gamma_r\) = 1 always. Which of these models is more likely to work without vanishing gradient problems even when trained on very long input sequences?
- Alice’s model (removing \(\Gamma_u\)), because if \(\Gamma_r\)≈0 for a timestep, the gradient can propagate back through that timestep without much decay.
- Alice’s model (removing \(\Gamma_u\)), because if \(\Gamma_r\)≈1 for a timestep, the gradient can propagate back through that timestep without much decay.
- Betty’s model (removing \(\Gamma_r\)), because if \(\Gamma_u\)≈0 for a timestep, the gradient can propagate back through that timestep without much decay.
- Betty’s model (removing \(\Gamma_r\)), because if \(\Gamma_u\)≈1 for a timestep, the gradient can propagate back through that timestep without much decay.
Yes, For the signal to backpropagate without vanishing, we need \(c^{<t>}\) to be highly dependant on \(c^{<t-1>}\)
- Here are the equations for the GRU and the LSTM:
From these, we can see that the Update Gate and Forget Gate in the LSTM play a role similar to _______ and ______ in the GRU. What should go in the the blanks?
- \(\Gamma_u\) and 1−\(\Gamma_u\)
- \(\Gamma_u\) and \(\Gamma_r\)
- 1−\(\Gamma_u\) and \(\Gamma_u\)
- \(\Gamma_r\) and \(\Gamma_u\)
- You have a pet dog whose mood is heavily dependent on the current and past few days’ weather. You’ve collected data for the past 365 days on the weather, which you represent as a sequence as \(x^{<1>}, …, x^{<365>}\). You’ve also collected data on your dog’s mood, which you represent as \(y^{<1>}, …, y^{<365>}\). You’d like to build a model to map from x→y. Should you use a Unidirectional RNN or Bidirectional RNN for this problem?
- Bidirectional RNN, because this allows the prediction of mood on day t to take into account more information.
- Bidirectional RNN, because this allows backpropagation to compute more accurate gradients.
- Unidirectional RNN, because the value of \(y^{<t>}\) depends only on \(x^{<1>}, …, x^{<t>}\), but not on \(x^{<t+1>}, …, x^{<365>}\)
- Unidirectional RNN, because the value of \(y^{<t>}\) depends only on \(x^{<t>}\), and not other days’ weather.
【中英】【吴恩达课后测验】Course 5 - 序列模型 - 第一周测验的更多相关文章
- 【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验【中英】
[中英][吴恩达课后测验]Course 1 - 神经网络和深度学习 - 第二周测验 第2周测验 - 神经网络基础 神经元节点计算什么? [ ]神经元节点先计算激活函数,再计算线性函数(z = Wx + ...
- 【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第一周测验【中英】
[吴恩达课后测验]Course 1 - 神经网络和深度学习 - 第一周测验[中英] 第一周测验 - 深度学习简介 和“AI是新电力”相类似的说法是什么? [ ]AI为我们的家庭和办公室的个人设备供电 ...
- 【中文】【deplearning.ai】【吴恩达课后作业目录】
[目录][吴恩达课后作业目录] 吴恩达深度学习相关资源下载地址(蓝奏云) 课程 周数 名称 类型 语言 地址 课程1 - 神经网络和深度学习 第1周 深度学习简介 测验 中英 传送门 无编程作业 编程 ...
- 吴恩达课后作业学习1-week4-homework-two-hidden-layer -1
参考:https://blog.csdn.net/u013733326/article/details/79767169 希望大家直接到上面的网址去查看代码,下面是本人的笔记 两层神经网络,和吴恩达课 ...
- 吴恩达课后作业学习1-week4-homework-multi-hidden-layer -2
参考:https://blog.csdn.net/u013733326/article/details/79767169 希望大家直接到上面的网址去查看代码,下面是本人的笔记 实现多层神经网络 1.准 ...
- 吴恩达课后作业学习2-week1-1 初始化
参考:https://blog.csdn.net/u013733326/article/details/79847918 希望大家直接到上面的网址去查看代码,下面是本人的笔记 初始化.正则化.梯度校验 ...
- 吴恩达课后作业学习2-week1-2正则化
参考:https://blog.csdn.net/u013733326/article/details/79847918 希望大家直接到上面的网址去查看代码,下面是本人的笔记 4.正则化 1)加载数据 ...
- 吴恩达深度学习第2课第2周编程作业 的坑(Optimization Methods)
我python2.7, 做吴恩达深度学习第2课第2周编程作业 Optimization Methods 时有2个坑: 第一坑 需将辅助文件 opt_utils.py 的 nitialize_param ...
- 吴恩达老师机器学习课程chapter05——评估模型
吴恩达老师机器学习课程chapter05--评估模型 本文是非计算机专业新手的自学笔记,高手勿喷. 本文仅作速查备忘之用,对应吴恩达(AndrewNg)老师的机器学期课程第十章.第十一章. 目录 吴恩 ...
- 吴恩达深度学习第4课第3周编程作业 + PIL + Python3 + Anaconda环境 + Ubuntu + 导入PIL报错的解决
问题描述: 做吴恩达深度学习第4课第3周编程作业时导入PIL包报错. 我的环境: 已经安装了Tensorflow GPU 版本 Python3 Anaconda 解决办法: 安装pillow模块,而不 ...
随机推荐
- 【记录】C-文件输入输出
写在开头 摸鱼摸得昏天黑地,是该炸一炸鱼的本愿了~ 以前总觉得笔记没什么重要的,但有时事到临头,又十分渴求简明的提纲来唤起记忆/提供重学的门路.于是就有了以下的产物,也希望能抑制一下无效摸鱼的堕落 ...
- mysql存储过程之循环遍历查询结果集
mysql存储过程之循环遍历查询结果集 -- 创建存储过程之前需判断该存储过程是否已存在,若存在则删除 DROP PROCEDURE IF EXISTS init_reportUrl; -- 创建存储 ...
- golang interface 转 string、int、float64
interface{} interface{} 接口.interface{} 类型很多人都会混淆.interface{} 类型是没有方法的接口.由于没有 implements 关键字,所以说所有的类型 ...
- Python进阶知识:多进程/多线程/装饰器
本文写作于2025.3.20,恰好作者正好在外面实习,于此同时在实际工作中遇到这些知识点,因此就进行一个简短汇总方便后续回顾,内容同步更新(显示问题可以直接看):https://www.big-yel ...
- sql 使用with 递归
---前提:有上下级关系的关系表 ---示例:组织架构表 DECLARE @orgId NVARCHAR(20)='0001'; --向下递归,查询@orgId 下的所有结点...包括儿子-孙子节 ...
- C# 13 中的新增功能实操
前言 今天大姚带领大家一起来看看 C# 13 中的新增几大功能,并了解其功能特性和实际应用场景. 前提准备 要体验 C# 13 新增的功能可以使用最新的 Visual Studio 2022 版本或 ...
- 初识if,if的三种结构
1.if语句 流程控制语句:通过一语句,来控制程序的执行流程.其中if属于分支结构 2.if语句的第一种格式 . 实操: 3.if的第二种格式 实操: 4.if的第三种格式 实操: 5.注意事项 在i ...
- ASP.NET 简单实现数字时钟
每隔1000毫秒(1s)获取一次当前时间 <asp:ScriptManager ID="ScriptManager_Time" runat="server" ...
- STM32 DMA中的DMA_BufferSize和DMA_MemoryDataSize
示例代码1 采集2通道ADC数据 查看代码 extern uint16_t ADC3ConvertedValue[2]; /* DMA2 Stream0 channel2 配置 *********** ...
- live555开发笔记(二):live555创建RTSP服务器源码剖析,创建rtsp服务器的基本流程总结
前言 基于Live555的流媒体服务器方案源码剖析,了解基本的代码搭建步骤. Demo 关于.h264与.265 没深入研究,但是h264的后缀名.264替换为.h264文件, ...