Week 2 Exercise 3 - sigmoid

may i ask how to present 𝑧=𝑤𝑇𝑥+𝑏 from array np.array([0,2]) ?

The mathematical expression for the “linear activation” is:

z = w^T \cdot x + b

In that expression, w is a column vector of dimensions n_x x 1 and x is also a column vector of dimension n_x x 1, where n_x is the number of “features” or elements in each input. b is a scalar. The operation between w and x is the “dot product” which will end up giving us this sum:

\displaystyle \sum_{i = 1}^{n_x} w_i * x_i

The sum of the products of the elements of the two vectors. Then we add b which is a scalar to get the final answer for z.

The way you express that dot product operation in numpy is to use the function np.dot. That has been covered in the first exercise, right? Of course you have to transpose w first in order for the dot product to work: 1 x n_x dotted with n_x x 1 gives you a 1 x 1 or scalar output. The way you express transpose in numpy is just to write w.T or you can call the np.transpose function.

Also note that all this computation to produce z does not happen inside the sigmoid function. You do that in propagate and then you call sigmoid with the result, right?

Also note that you’ve posted in General Discussion again. I moved it for you again. Please use the DLS Course 1 category for asking questions about DLS Course 1.