【中英】【吴恩达课后测验】Course 5 -序列模型 - 第二周测验 - 自然语言处理与词嵌入


上一篇:【课程5 - 第一周编程作业】※※※※※ 【回到目录】※※※※※下一篇:【课程5 -第二周编程作业】


  1. 假设你为10000个单词学习词嵌入,为了捕获全部范围的单词的变化以及意义,那么词嵌入向量应该是10000维的。

    • 【 】 正确
    • 【★】 错误
  2. 什么是t-SNE?

    • 【★】 一种非线性降维算法。
    • 【 】 一种能够解决词向量上的类比的线性变换。
    • 【 】 一种用于学习词嵌入的监督学习算法。
    • 【 】 一个开源序列模型库。
  3. 假设你下载了一个已经在一个很大的文本语料库上训练过的词嵌入的数据,然后你要用这个词嵌入来训练RNN并用于识别一段文字中的情感,判断这段文字的内容是否表达了“快乐”。

x(输入文本) y (是否快乐)
我今天感觉很好! 1
我觉得很沮丧,因为我的猫生病了。 0
真的很享受这个! 1

  那么即使“欣喜若狂”这个词没有出现在你的小训练集中,你的RNN也会认为“我欣喜若狂”应该被贴上$y = 1$的标签。

  • 【★】 正确
  • 【 】 错误
  1. 对于词嵌入而言,下面哪一个(些)方程是成立的?

    • 【★】 \(e_{boy} - e_{girl} ≈ e_{brother} - e_{sister}\)
    • 【 】 \(e_{boy} - e_{girl} ≈ e_{sister} - e_{brother}\)
    • 【★】 $e_{boy} - e_{brother} ≈ e_{girl} - e_{sister} $
    • 【 】 $e_{boy} - e_{brother} ≈ e_{sister} - e_{girl} $
  2. 设\(E\)为嵌入矩阵,\(e_{1234}\)对应的是词“1234”的独热向量,为了获得1234的词嵌入,为什么不直接在Python中使用代码\(E∗e_{1234}\)呢?

    • 【★】 因为这个操作是在浪费计算资源。
    • 【 】 因为正确的计算方式是\(E^T ∗ e_{1234}\)。
    • 【 】 因为它没有办法处理未知的单词(<UNK>)。
    • 【 】 以上全都不对,因为直接调用\(E∗e_{1234}\)是最好的方案。
  3. 在学习词嵌入时,我们创建了一个预测\(P(target \mid context)\)的任务,如果这个预测做的不是很好那也是没有关系的,因为这个任务更重要的是学习了一组有用的嵌入词。

    • 【 】 正确
    • 【★】 错误
  4. 在word2vec算法中,你要预测\(P(t \mid c)\),其中\(t\)是目标词(target word),\(c\)是语境词(context word)。你应当在训练集中怎样选择\(t\) 与 \(c\)呢?

    • 【★】 \(c\) 与 \(t\) 应当在附近词中。
    • 【 】 \(c\) 是在\(t\)前面的一个词。
    • 【 】 \(c\) 是\(t\)之前句子中所有单词的序列。
    • 【 】 \(c\) 是\(t\)之前句子中几个单词的序列。
  5. 假设你有1000个单词词汇,并且正在学习500维的词嵌入,word2vec模型使用下面的softmax函数:

\[P(t \mid c)=\frac{e^{\theta_t^T e_c}}{\sum_{t′=1}^{10000} e^{\theta_{t'}^T e_c}}
\]

以下说法中哪一个(些)是正确的?

- 【★】 \(\theta_t\) 与 \(e_c\) 都是500维的向量。

- 【 】 \(\theta_t\) 与 \(e_c\) 都是10000维的向量。

- 【★】 \(\theta_t\) 与 \(e_c\) 都是通过Adam或梯度下降等优化算法进行训练的。

- 【 】 训练之后,\(\theta_t\)应该非常接近\(e_c\),因为\(t\)和\(c\)是一个词。

  1. 假设你有10000个单词词汇,并且正在学习500维的词嵌入,GloVe模型最小化了这个目标:
\[\min \sum^{10,000}_{i=1}\sum^{10,000}_{j=1}f(X_{ij})(\theta^T_ie_j+b_i+b′_j−logX_{ij})^2
\]

以下说法中哪一个(些)是正确的?

- 【 】 \(\theta_i\) 与 \(e_j\) 应当初始化为0。

- 【★】 \(\theta_i\) 与 \(e_j\) 应当使用随机数进行初始化。

- 【★】 \(X_{ij}\) 是单词i在j中出现的次数。

- 【★】 加权函数 \(f(.)\) 必须满足 \(f(0)=0\)。

> The weighting function helps prevent learning only from extremely common word pairs. It is not necessary that it satisfies this function.

>

> 加权函数有助于防止仅从非常常见的单词对中学习,它不必满足这个函数。

  1. 你已经在文本数据集\(m_1\)上训练了词嵌入,现在准备将它用于一个语言任务中,对于这个任务,你有一个单独标记的数据集\(m_2\) ,请记住,使用词嵌入是一种迁移学习的形式,在这种情况下,你认为词嵌入会有帮助吗?
  • 【★】 \(m_1 >> m_2\)
  • 【 】 \(m_1 << m_2\)

Natural Language Processing & Word Embeddings

  1. Suppose you learn a word embedding for a vocabulary of 10000 words. Then the embedding vectors should be 10000 dimensional, so as to capture the full range of variation and meaning in those words.

    • True
    • False

  1. What is t-SNE?

    • A non-linear dimensionality reduction technique.
    • A linear transformation that allows us to solve analogies on word vectors.
    • A supervised learning algorithm for learning word embeddings.
    • An open-source sequence modeling library.

  1. Suppose you download a pre-trained word embedding which has been trained on a huge corpus of text. You then use this word embedding to train an RNN for a language task of recognizing if someone is happy from a short snippet of text, using a small training set.
x(input text) y (happy?)
I'm feeling wonderful today! 1
I'm bummed my cat is ill. 0
Really enjoying this! 1
Then even if the word "ecstatic" does not appear in your small training
set, your RNN might reasonably be expected to recognize "I’m ecstatic"
as deserving a label $y = 1$.

Then even if the word "ecstatic" does not appear in your small training set, your RNN might reasonably be expected to recognize "I’m ecstatic" as deserving a label \(y = 1\).

- [x] True

- [ ] False


  1. Which of these equations do you think should hold for a good word embedding? (Check all that apply)

    • \(e_{boy} - e_{girl} ≈ e_{brother} - e_{sister}\)
    • \(e_{boy} - e_{girl} ≈ e_{sister} - e_{brother}\)
    • $e_{boy} - e_{brother} ≈ e_{girl} - e_{sister} $
    • $e_{boy} - e_{brother} ≈ e_{sister} - e_{girl} $

  1. Let \(E\) be an embedding matrix, and let \(e_{1234}\) be a one-hot vector corresponding to word 1234. Then to get the embedding of word 1234, why don’t we call \(E∗e_{1234}\) in Python?

    • It is computationally wasteful.
    • The correct formula is \(E^T∗e_{1234}\).
    • This doesn’t handle unknown words ().
    • None of the above: Calling the Python snippet as described above is fine.

  1. When learning word embeddings, we create an artificial task of estimating \(P(target \mid context)\). It is okay if we do poorly on this artificial prediction task; the more important by-product of this task is that we learn a useful set of word embeddings.

    • True
    • False

  1. In the word2vec algorithm, you estimate \(P(t \mid c)\), where \(t\) is the target word and \(c\) is a context word. How are \(t\) and \(c\) chosen from the training set? Pick the best answer.

    • \(c\) and \(t\) are chosen to be nearby words.
    • \(c\) is the one word that comes immediately before \(t\).
    • \(c\) is the sequence of all the words in the sentence before \(t\).
    • \(c\) is a sequence of several words immediately before \(t\).

  1. Suppose you have a 10000 word vocabulary, and are learning 500-dimensional word embeddings. The word2vec model uses the following softmax function:

    \(P(t \mid c)=\frac{e^{\theta_t^T e_c}}{\sum_{t′=1}^{10000} e^{\theta_{t'}^T e_c}}\)

    Which of these statements are correct? Check all that apply.

    • \(\theta_t\) and \(e_c\) are both 500 dimensional vectors.
    • \(\theta_t\) and \(e_c\) are both 10000 dimensional vectors.
    • \(\theta_t\) and \(e_c\) are both trained with an optimization algorithm such as Adam or gradient descent.
    • After training, we should expect \(\theta_t\) to be very close to \(e_c\) when \(t\) and \(c\) are the same word.

  1. Suppose you have a 10000 word vocabulary, and are learning 500-dimensional word embeddings.The GloVe model minimizes this objective:

    \(\min \sum^{10,000}_{i=1}\sum^{10,000}_{j=1}f(X_{ij})(\theta^T_ie_j+b_i+b′_j−logX_{ij})^2\)

    Which of these statements are correct? Check all that apply.

    • \(\theta_i​\) and \(e_j​\) hould be initialized to 0 at the beginning of training.

    • \(\theta_i\) and \(e_j\) hould be initialized randomly at the beginning of training.

    • \(X_{ij}\) is the number of times word i appears in the context of word j.

    • The weighting function \(f(.)\) must satisfy \(f(0)=0\).

      The weighting function helps prevent learning only from extremely common word pairs. It is not necessary that it satisfies this function.


  1. You have trained word embeddings using a text dataset of \(m_1\) words. You are considering using these word embeddings for a language task, for which you have a separate labeled dataset of \(m_2\) words. Keeping in mind that using word embeddings is a form of transfer learning, under which of these circumstance would you expect the word embeddings to be helpful?
  • \(m_1 >> m_2\)
  • \(m_1 << m_2\)

【中英】【吴恩达课后测验】Course 5 -序列模型 - 第二周测验 - 自然语言处理与词嵌入的更多相关文章

  1. 【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验【中英】

    [中英][吴恩达课后测验]Course 1 - 神经网络和深度学习 - 第二周测验 第2周测验 - 神经网络基础 神经元节点计算什么? [ ]神经元节点先计算激活函数,再计算线性函数(z = Wx + ...

  2. 【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第一周测验【中英】

    [吴恩达课后测验]Course 1 - 神经网络和深度学习 - 第一周测验[中英] 第一周测验 - 深度学习简介 和“AI是新电力”相类似的说法是什么? [  ]AI为我们的家庭和办公室的个人设备供电 ...

  3. 【中文】【deplearning.ai】【吴恩达课后作业目录】

    [目录][吴恩达课后作业目录] 吴恩达深度学习相关资源下载地址(蓝奏云) 课程 周数 名称 类型 语言 地址 课程1 - 神经网络和深度学习 第1周 深度学习简介 测验 中英 传送门 无编程作业 编程 ...

  4. 吴恩达课后作业学习1-week4-homework-two-hidden-layer -1

    参考:https://blog.csdn.net/u013733326/article/details/79767169 希望大家直接到上面的网址去查看代码,下面是本人的笔记 两层神经网络,和吴恩达课 ...

  5. 吴恩达课后作业学习1-week4-homework-multi-hidden-layer -2

    参考:https://blog.csdn.net/u013733326/article/details/79767169 希望大家直接到上面的网址去查看代码,下面是本人的笔记 实现多层神经网络 1.准 ...

  6. 吴恩达课后作业学习2-week1-1 初始化

    参考:https://blog.csdn.net/u013733326/article/details/79847918 希望大家直接到上面的网址去查看代码,下面是本人的笔记 初始化.正则化.梯度校验 ...

  7. 吴恩达课后作业学习2-week1-2正则化

    参考:https://blog.csdn.net/u013733326/article/details/79847918 希望大家直接到上面的网址去查看代码,下面是本人的笔记 4.正则化 1)加载数据 ...

  8. 吴恩达深度学习第2课第2周编程作业 的坑(Optimization Methods)

    我python2.7, 做吴恩达深度学习第2课第2周编程作业 Optimization Methods 时有2个坑: 第一坑 需将辅助文件 opt_utils.py 的 nitialize_param ...

  9. 吴恩达老师机器学习课程chapter05——评估模型

    吴恩达老师机器学习课程chapter05--评估模型 本文是非计算机专业新手的自学笔记,高手勿喷. 本文仅作速查备忘之用,对应吴恩达(AndrewNg)老师的机器学期课程第十章.第十一章. 目录 吴恩 ...

  10. 吴恩达深度学习第4课第3周编程作业 + PIL + Python3 + Anaconda环境 + Ubuntu + 导入PIL报错的解决

    问题描述: 做吴恩达深度学习第4课第3周编程作业时导入PIL包报错. 我的环境: 已经安装了Tensorflow GPU 版本 Python3 Anaconda 解决办法: 安装pillow模块,而不 ...

随机推荐

  1. 厦门大学3篇DeepSeek报告pdf汇总(附下载地址)

    最近,厦门大学大数据教学团队发布了3份DeepSeek大模相关报告.其中<DeepSeek大模型企业应用实践,全景解读与技术演进>这份报告足足有150页,把国产大模型在企业里怎么用.技术上 ...

  2. AI Agent爆火后,MCP协议为什么如此重要!

    什么是MCP? 模型上下文协议(Model Context Protocol, MCP)是一种专为机器学习模型服务设计的通信协议,旨在高效管理模型推理过程中的上下文信息(如会话状态.环境变量.动态配置 ...

  3. 自制一个超级简单的 php 发邮件的轮子 simpleMailTool.php

    simpleMailTool 程序链接 https://github.com/kohunglee/simpleMailTool/ 一个简单的 php 发邮件的轮子,跟其他著名大轮子相比(如 PHPMa ...

  4. MySQL-InnoDB行锁

    InnoDB的锁类型 InnoDB存储引擎支持行锁,锁类型有两种: 共享锁(S锁) 排他锁(X锁) S和S不互斥,其他均互斥. 除了这两种锁以外,innodb还支持一种锁,叫做意向锁. 那么什么是意向 ...

  5. Ubuntu安装mosquitto并进行配置

    要在Ubuntu上安装Mosquitto并进行配置,你可以按照以下步骤进行操作: 打开终端. 更新软件包列表,使用以下命令: sudo apt update 安装Mosquitto包,使用以下命令: ...

  6. StringBuilder的介绍、构造方法及成员方法

    1.StringBuilder的介绍 1.StringBuilder是字符串缓冲区,可以认为是一种容器,能装任何类型的数据,但被装入的数据都会变为字符串 如图 无论是什么类型的数据,被装入字符串缓冲区 ...

  7. python练习-爬虫

    场景: 1.网址hppt://xxx.yyy.zzz.cn2.打开网页后显示 : 3.填上姓名 身份证和验证码,点击查询后,返回查询结果. 4.页面有cookie. 方案一: 程序中嵌入浏览器根据网址 ...

  8. ubuntu 22.04安装NFS

    一.概述 1. 定义 NFS(Network File System)是一种分布式文件系统协议,最初由 Sun Microsystems 开发,并于1984年发布.它允许不同主机通过网络共享文件和目录 ...

  9. Redis 集群实现分布式缓存的示例操作流程【Redis 系列之五】

    〇.前言 Redis 集群的核心优势在于高可用性.可扩展性和高性能,特别适合需要处理大规模数据和高并发请求的应用场景. 本文先介绍了什么是 Redis 集群,然后通过示例,以手动和自动两种方式搭建集群 ...

  10. Python科学计算系列10—数论

    1.常用操作 代码如下: # coding=utf-8 from sympy import * from sympy.ntheory.modular import solve_congruence, ...