Andrew Deeplearning.ai 第二周作业记录

以下只是我自己的做题记录,方便之后自我检查,不代表正确答案:

  1. What does a neuron compute?
    B. A neuron computes a linear function (z = Wx + b) followed by an activation function

  2. Which of these is the "Logistic Loss"?
    D. L(i)(y^(i),y(i))=−(y(i)log(y^(i))+(1−y(i))log(1−y^(i)))

  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?
    A. x = img.reshape((32323,1))

  4. 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

What will be the shape of "c"?
A. c.shape = (2, 3)

  1. 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
A. The computation cannot happen because the sizes don't match. It's going to be "Error"!
  1. Suppose you have nx input features per example. Recall that X=[x(1)x(2)...x(m)]. What is the dimension of X?
    C. (1,m)

  2. Recall that "np.dot(a,b)" performs a matrix multiplication on a and b, whereas "a*b" performs an element-wise multiplication.
    A. c.shape = (12288, 45)

  3. 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]
B. c = a + b.T
  1. Consider the following code:
a = np.random.randn(3, 3)
b = np.random.randn(3, 1)
c = a*b

What will be c? (If you’re not sure, feel free to run this in python to find out).
B. This will invoke broadcasting, so b is copied three times to become (3, 3), and ∗ invokes a matrix multiplication operation of two 3x3 matrices so c.shape will be (3, 3)

  1. Consider the following computation graph. computation graph. What is the output J?
    B. J = (a - 1) * (b + c)

转载于:https://my.oschina.net/flyrobin/blog/1542354

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值