吴恩达深度学习课程练习题汇总(第二周)
1.What does a neuron compute?(神經元節點計算什么?)
A neuron computes a linear function (z = Wx + b) followed by an activation function(神經元節點先計算線性函數(z = Wx + b),再計算激活。)
2、Which of these is the “Logistic Loss”?(下面哪一個是 Logistic 損失?
損失函數:𝐿(𝑦^(𝑖) , 𝑦(𝑖)) = ?𝑦(𝑖)log 𝑦^(𝑖) ? (1 ? 𝑦(𝑖))log(1 ? 𝑦^(𝑖))
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 像素的圖像。 如何將其重新轉換為列向量?)
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 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
ab中表示元素乘法,是兩個矩陣之間對應的元素相乘,需要兩個矩陣之間的維數相同
6、Suppose you have 𝒏𝒙 input features per example. Recall that 𝑿 = [𝒙(𝟏), 𝒙(𝟐) … 𝒙(𝒎)]. What is the dimension of X?(假設你的每一個樣本有𝒏𝒙個輸入特征,想一下在 𝑿 = [𝒙(𝟏), 𝒙(𝟐) … 𝒙(𝒎)]中,X 的維度是多少?)
(𝒏𝒙,m)
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”:)
請問c的維度是多少?
解答:
np.dot(a,b)計算的是元素的內積,在線性代數中相當于矩陣的乘法。
8、看一下下面的這個代碼片段:請問要怎么把它們向量化?
9、看一下下面的代碼:請問 c 的維度會是多少?
a = np.random.randn(3, 3) b = np.random.randn(3, 1) c = a * bc.shape = (3, 3)
這里將會使用廣播機制,b 會被復制三次,再使用元素乘法。
10、看一下下面的計算圖,J 輸出是什么:
J = u + v - w
= a * b + a * c - (b + c)
= a * (b + c) - (b + c)
= (a - 1) * (b + c)
總結
以上是生活随笔為你收集整理的吴恩达深度学习课程练习题汇总(第二周)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: .net分层架构思想(彻底分离每个层)
- 下一篇: 吴恩达深度学习第三周