导语

本文翻译自deeplearning.ai的深度学习课程测试作业,近期将逐步翻译完毕,一共五门课。

翻译:黄海广

本集翻译Lesson1 Week 2:

Lesson1 Neural Networks and Deep Learning (第一门课 神经网络和深度学习)

Week 2 Quiz - Neural Network Basics(第二周测验 - 神经网络基础)

1.What does a neuron compute?(神经元节点计算什么?)

【 】 A neuron computes an activation function followed by a linear function (z = Wx + b)(神经元节点先计算激活函数,再计算线性函数(z = Wx + b))

【★】 A neuron computes a linear function (z = Wx + b) followed by an activation function(神经元节点先计算线性函数(z = Wx + b),再计算激活。)

【 】 A neuron computes a function g that scales the input x linearly (Wx +b)(神经元节点计算函数g,函数g计算(Wx + b))

【 】 A neuron computes the mean of all features before applying the output to an activation function(在将输出应用于激活函数之前,神经元节点计算所有特征的平均值)

Note: The output of a neuron is a = g(Wx + b) where g is the activation function (sigmoid, tanh, ReLU, …).(注:神经元的输出是a = g(Wx + b),其中g是激活函数(sigmoid,tanh,ReLU,…))

2. Which of these is the “Logistic Loss”?(下面哪一个是Logistic损失?)

【★】损失函数:

Note: We are using a cross-entropy loss function.(注:我们使用交叉熵损失函数。)

3. Suppose img is a (32,32,3) array, representing a 32x32 image with 3 color channels red, green and blue. How do you reshape this into a column vector?(假设img是一个(32,32,3)数组,具有3个颜色通道:红色、绿色和蓝色的32x32像素的图像。如何将其重新转换为列向量?)

Answer(答):

x = img.reshape((32 * 32 * 3, 1))

4. Consider the two following random arrays “a” and “b”:(看一下下面的这两个随机数组“a”和“b”:)

a = np.random.randn(2, 3) # a.shape = (2, 3)
b = np.random.randn(2, 1) # b.shape = (2, 1)
c = a + b

What will be the shape of “c”?(请问数组c的维度是多少?)

Answer(答):

c.shape = (2, 3)

b (column vector) is copied 3 times so that it can be summed to each column of a. Therefore, c.shape = (2, 3).( B(列向量)复制3次,以便它可以和A的每一列相加,所以:c.shape = (2, 3))

5. Consider the two following random arrays “a” and “b”:(看一下下面的这两个随机数组“a”和“b”)

a = np.random.randn(4, 3) # a.shape = (4, 3)
b = np.random.randn(3, 2) # b.shape = (3, 2)
c = a * b

What will be the shape of “c”?(请问数组“c”的维度是多少?)

Answer(答):

The computation cannot happen because the sizes don’t match. It’s going to be “error”!(无法进行计算,因为大小不匹配。将会报错!)

Note:“*” operator indicates element-wise multiplication. Element-wise multiplication requires same dimension between two matrices. It’s going to be an error.(注:运算符 “*” 说明了按元素乘法来相乘,但是元素乘法需要两个矩阵之间的维数相同,所以这将报错,无法计算。)

6. Suppose you have  input features per example. Recall that . What is the dimension of X?(假设你的每一个样本有个输入特征,想一下在 中,X的维度是多少?)

Answer(答):

Note: A stupid way to validate this is use the formula

when, then we have(请注意:一个比较笨的方法是当的时候,那么计算一下,所以我们就有:

7. Recall that np.dot(a,b) performs a matrix multiplication on a and b, whereas a*b performs an element-wise multiplication.(回想一下,np.dot(a,b)在a和b上执行矩阵乘法,而“a * b”执行元素方式的乘法。)Consider the two following random arrays “a” and “b”:(看一下下面的这两个随机数组“a”和“b”:)

  • a = np.random.randn(12288, 150) # a.shape = (12288, 150)
    b = np.random.randn(150, 45) # b.shape = (150, 45)
    c = np.dot(a, b)

    What is the shape of c?(请问c的维度是多少?)

Answer(答):

c.shape = (12288, 45), this is a simple matrix multiplication example.( c.shape = (12288, 45), 这是一个简单的矩阵乘法例子。)

8. Consider the following code snippet:(看一下下面的这个代码片段:)

# a.shape = (3,4)

# b.shape = (4,1)

for i in range(3):for j in range(4):c[i][j] = a[i][j] + b[j]

How do you vectorize this?(请问要怎么把它们向量化?)

Answer(答):

c = a + b.T

9. Consider the following code:(看一下下面的代码:)

a = np.random.randn(3, 3)
b = np.random.randn(3, 1)
c = a * b

What will be c?(请问c的维度会是多少?)

Answer(答):

c.shape = (3, 3)

This will invoke broadcasting, so b is copied three times to become (3,3), and * is an element-wise product so c.shape = (3, 3).(这将会使用广播机制,b会被复制三次,就会变成(3,3),再使用元素乘法。所以:c.shape = (3, 3).)

10. Consider the following computation graph,What is the output J.(看一下下面的计算图,J输出是什么:)

J = u + v - w
= a * b + a * c - (b + c)
= a * (b + c) - (b + c)
= (a - 1) * (b + c)

Answer(答):

J=(a - 1) * (b + c)

备注:公众号菜单包含了整理了一本AI小抄非常适合在通勤路上用学习

往期精彩回顾2019年公众号文章精选适合初学者入门人工智能的路线及资料下载机器学习在线手册深度学习在线手册AI基础下载(第一部分)备注:加入本站微信群或者qq群,请回复“加群”加入知识星球(4500+用户,ID:92416895),请回复“知识星球”

喜欢文章,点个在看

原文翻译:深度学习测试题(L1 W2 测试题)相关推荐

  1. face recognition[翻译][深度学习理解人脸]

    本文译自<Deep learning for understanding faces: Machines may be just as good, or better, than humans& ...

  2. 深度学习正则化(L1 norm/L2 norm)以及dropout理解

    正则化知识其实是深度学习领域较为基础的知识点,初入此门的时候受限于正则化三个字的逼格,一直不求甚解:后期虽然了解但也仅限于L1和L2范数而已.恰巧上周在谢毅博士的课上旁听,讲到过拟合相关知识,后续和捷 ...

  3. 论文翻译 - 深度学习社区发现综述 A Comprehensive Survey on Community Detection with Deep Learning

    为大家介绍一篇「深度学习」在社区发现(图聚类/图划分)方面应用的最新综述论文. 作者:Xing Su 原文链接:https://arxiv.org/abs/2105.12584 Github链接:ht ...

  4. 深度学习: smooth L1 loss 计算

    RPN的目标函数是分类和回归损失的和,分类采用 交叉熵,回归采用稳定的 Smooth L1, SmoothL1公式 为: 整体损失函数 具体为: Smooth L1 相比于L1损失函数,可以收敛得更快 ...

  5. 【深度学习】L1、L2损失 和 L1、L2正则化

    损失函数: L1损失: n个样本的平均绝对误差(MAE): 即,真实值和预测值之间的差值的绝对值的和. 使用L1损失函数,就是最小化MAE. L2损失: n个样本的均方误差(MSE): 即,真实值和预 ...

  6. 深度学习 | 训练及优化方法

    ---------------------------- 原文发表于夏木青 | JoselynZhao Blog,欢迎访问博文原文. ---------------------------- 深度学习 ...

  7. 深度学习笔记之《解析卷积神经网络》附下载地址

    点击上方"Datawhale",选择"星标"公众号 第一时间获取价值内容 <解析卷积神经网络>是 @魏秀参 博士撰写的深度学习实践手册,主要以卷积神 ...

  8. 一文弄懂元学习 (Meta Learing)(附代码实战)《繁凡的深度学习笔记》第 15 章 元学习详解 (上)万字中文综述

    <繁凡的深度学习笔记>第 15 章 元学习详解 (上)万字中文综述(DL笔记整理系列) 3043331995@qq.com https://fanfansann.blog.csdn.net ...

  9. 深度学习框架Caffe源码解析

    作者:薛云峰(https://github.com/HolidayXue),主要从事视频图像算法的研究, 本文来源微信公众号:深度学习大讲堂.  原文:深度学习框架Caffe源码解析  欢迎技术投稿. ...

最新文章

  1. oracle job使用详解及job不运行的检查方法
  2. 【博弈论】【SG函数】bzoj1457 棋盘游戏
  3. 查看用户账户过期信息
  4. Flex通用克隆(clone)方法
  5. expdp和impdp的用法详解
  6. 十年 IT 老兵带你通过案例学架构,附C#代码
  7. 一些不起眼但非常有用的 Vim 命令
  8. 泛泰A880S升级官方4.4.2 binx教程
  9. 命令行出错Exception in thread main java.lang.UnsupportedClassVersionError:
  10. androidentity什么用_Android multipartentity的用法
  11. 对C语言实验报告的建议,c语言实验报告.docx
  12. ViT (Vision Transformer) ---- Transformer Model(1)
  13. NLP—1.自然语言处理的基础任务与应用
  14. 惠普1139一体打印机如何联网打印_惠普1139打印机驱动安装步骤 LaserJet Pro M1139MFP打印机开箱后怎么安装...
  15. 自动驾驶-MPC控制器
  16. r语言 svycoxph_R语言之生信⑦Cox比例风险模型(单因素)
  17. java多线程聊天室_JAVA多线程网络聊天室代码
  18. JDK命令八、NMT 和 pmap本地内存分析神器
  19. 手把手教你搭建一个【文件共享平台】系列教程第二话——环境搭建
  20. postgresql安装教程(Windows)

热门文章

  1. 理解Vue 2.5的Diff算法
  2. 第二次作业:王者荣耀软件分析
  3. Struts2之Ognl
  4. mysql权限与安全
  5. CTO 比普通程序员强在哪?
  6. Mono.Android 基础
  7. PHP程序员的技术成长规划(转)
  8. Selenium2Library关键字(1)
  9. C++ stl 通用算法和成员函数使用
  10. Web架构师成长之路