【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验【中英】
【中英】【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验
第2周测验 - 神经网络基础
神经元节点计算什么?
【 】神经元节点先计算激活函数,再计算线性函数(z = Wx + b)
【
★
】神经元节点先计算线性函数(z = Wx + b),再计算激活。【 】神经元节点计算函数g,函数g计算(Wx + b)。
【 】在 将输出应用于激活函数之前,神经元节点计算所有特征的平均值
请注意:神经元的输出是a = g(Wx + b),其中g是激活函数(sigmoid,tanh,ReLU,…)。
下面哪一个是Logistic损失?
- 点击这里.
请注意:我们使用交叉熵损失函数。
假设img是一个(32,32,3)数组,具有3个颜色通道:红色、绿色和蓝色的32x32像素的图像。 如何将其重新转换为列向量?
x = img.reshape((32 * 32 * 3, 1))
- 1
- 1
- 2
- 3
请问数组
c
的维度是多少?答: B(列向量)复制3次,以便它可以和A的每一列相加,所以:
c.shape = (2, 3)
- 1
- 2
- 3
请问数组“
c
”的维度是多少?答:运算符 “*” 说明了按元素乘法来相乘,但是元素乘法需要两个矩阵之间的维数相同,所以这将报错,无法计算。
假设你的每一个实例有n_x个输入特征,想一下在X=[x^(1), x^(2)…x^(m)]中,X的维度是多少?
答:
(n_x, m)
请注意:一个比较笨的方法是当
l=1
的时候,那么计算一下Z(l)=W(l)A(l)Z(l)=W(l)A(l) ,所以我们就有:- A(1)A(1) = X
- X.shape = (n_x, m)
- Z(1)Z(1) .shape = (n(1)n(1) , m)
- W(1)W(1) .shape = (n(1)n(1) , n_x)
回想一下,
np.dot(a,b)
在a和b上执行矩阵乘法,而`a * 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)
- 1
- 2
- 3
请问c的维度是多少?
答:
c.shape = (12288, 45)
, 这是一个简单的矩阵乘法例子。看一下下面的这个代码片段:
# 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]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
请问要怎么把它们向量化?
答:
c = a + b.T
看一下下面的代码:
a = np.random.randn(3, 3)
b = np.random.randn(3, 1)
c = a * b
- 1
- 2
- 3
请问c的维度会是多少?
答:这将会使用广播机制,b会被复制三次,就会变成(3,3),再使用元素乘法。所以:c.shape = (3, 3)
.看一下下面的计算图:
J = u + v - w
= a * b + a * c - (b + c)
= a * (b + c) - (b + c)
= (a - 1) * (b + c)
- 1
- 2
- 3
- 4
答:
(a - 1) * (b + c)
博主注:由于弄不到图,所以很抱歉。
Week 2 Quiz - Neural Network Basics
What does a neuron compute?
[ ] A neuron computes an activation function followed by a linear function (z = Wx + b)
[x] A neuron computes a linear function (z = Wx + b) followed by an activation function
[ ] A neuron computes a function g that scales the input x linearly (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, …).
Which of these is the “Logistic Loss”?
- Check here.
Note: We are using a cross-entropy loss function.
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?
x = img.reshape((32 * 32 * 3, 1))
Consider the two following random arrays “a” and “b”:
a = np.random.randn(2, 3) # a.shape = (2, 3)
b = np.random.randn(2, 1) # b.shape = (2, 1)
c = a + b
- 1
- 2
- 3
What will be the shape of “c”?
b (column vector) is copied 3 times so that it can be summed to each column of a. Therefore,
c.shape = (2, 3)
.Consider the two following random arrays “a” and “b”:
a = np.random.randn(4, 3) # a.shape = (4, 3)
b = np.random.randn(3, 2) # b.shape = (3, 2)
c = a * b
- 1
- 2
- 3
What will be the shape of “c”?
“*” operator indicates element-wise multiplication. Element-wise multiplication requires same dimension between two matrices. It’s going to be an error.
Suppose you have n_x input features per example. Recall that X=[x^(1), x^(2)…x^(m)]. What is the dimension of X?
(n_x, m)
Note: A stupid way to validate this is use the formula Z^(l) = W^(l)A^(l) when l = 1, then we have
- A^(1) = X
- X.shape = (n_x, m)
- Z^(1).shape = (n^(1), m)
- W^(1).shape = (n^(1), n_x)
Recall that
np.dot(a,b)
performs a matrix multiplication on a and b, whereasa*b
performs an element-wise multiplication.Consider the two following random arrays “a” and “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)
- 1
- 2
- 3
What is the shape of c?
c.shape = (12288, 45)
, this is a simple matrix multiplication example.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]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
How do you vectorize this?
c = a + b.T
Consider the following code:
a = np.random.randn(3, 3)
b = np.random.randn(3, 1)
c = a * b
- 1
- 2
- 3
What will be c?
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)
.Consider the following computation graph.
J = u + v - w
= a * b + a * c - (b + c)
= a * (b + c) - (b + c)
= (a - 1) * (b + c)
- 1
- 2
- 3
- 4
Answer:
(a - 1) * (b + c)
【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第二周测验【中英】的更多相关文章
- 【吴恩达课后测验】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)加载数据 ...
- 【吴恩达课后编程作业】第二周作业 - Logistic回归-识别猫的图片
1.问题描述 有209张图片作为训练集,50张图片作为测试集,图片中有的是猫的图片,有的不是.每张图片的像素大小为64*64 吴恩达并没有把原始的图片提供给我们 而是把这两个图片集转换成两个.h5文件 ...
- 吴恩达课后作业学习2-week3-tensorflow learning-1-基本概念
参考:https://blog.csdn.net/u013733326/article/details/79971488 希望大家直接到上面的网址去查看代码,下面是本人的笔记 到目前为止,我们一直在 ...
- 【神经网络与深度学习】Caffe部署中的几个train-test-solver-prototxt-deploy等说明
1:神经网络中,我们通过最小化神经网络来训练网络,所以在训练时最后一层是损失函数层(LOSS), 在测试时我们通过准确率来评价该网络的优劣,因此最后一层是准确率层(ACCURACY). 但是当我们真正 ...
随机推荐
- 谷歌、亚马逊相继宣布屏蔽 Flash 广告,又一个时代行将结束?【转载+整理】
原文地址 其实,如果你看一下乔布斯的传记,早在十几年以前,乔布斯就说过类似的话,他狠透了 Flash~ 据 InfoWorld 报道,谷歌已经正式宣布,在默认情况下,Chrome将不再自动播放Web页 ...
- 2D游戏新手引导点光源和类迷雾实现
一.新手引导须要的遮罩效果 一般做新手引导的时候,会把游戏画面变的半黑,然后须要玩家点击的地方就亮起来.经常使用的做法是採用遮罩来实现,可是仅仅能实现方形的,不能不规则图形.以及是全然挖空.做不到渐变 ...
- eclipse preference plugin development store and get
eclipse plugin development: E:\workspaces\Eclipse_workspace_rcp\.metadata\.plugins\org.eclipse.pde.c ...
- PC端和移动端在前端开发上的一些区别,前端里移动端到底比pc端多哪些知识
(1)———————— 前端里移动端到底比pc端多哪些知识,为啥面试时好多公司都问h5水平如何?我做过几年的web前端开发,就简单谈谈自己的感受吧.首先来看看PC端和移动端在前端开发上的一些区别: ( ...
- 【Windows】查看Windows上运行程序的异常日志
任何在windows系统上运行的程序,只要发生异常导致程序异常终止,windows都会在日志中详细记录这个异常.可以在计算机管理中查看,如图:也可以在操作中心查看,如图:
- 使用ExpandableListView以及如何优化view的显示减少内存占用
上篇博客讲到如何获取手机中所有歌曲的信息.本文就把上篇获取到的歌曲按照歌手名字分类.用一个ExpandableListView显示出来. MainActivity .java public cla ...
- React Native库版本升级与降级
迄今为止React Native获得了超过48K的star,最新版本0.44,已经趋于稳定.(官网地址:https://github.com/facebook/react-native).随着Reac ...
- x-pack
x-pack安装>官网安装步骤https://www.elastic.co/downloads/x-pack >x-pack简介X-Pack是一个Elastic Stack的扩展,将安全, ...
- 如何让vue文件中的代码在Sublime Text 3中高亮和智能提示
大家写在Sublime Text 3中编写vue文件时,会发现没有代码智能提示,清一色的黑底白字,不会像html.js一样变成彩色,给我们带来了很大的不便.所以需要安装一款叫作Vue Syntax H ...
- InstallShield:卸载时文字叠加,文字乱码
问题: InstallShield2010打包的程序.如果程序正在运行,卸载程序,提示关闭程序,然后消息界面出现文字叠加. 定位问题: 新建Installshield项目,依次修改SetupType, ...