<jupyter_start><jupyter_text>1. What does a neuron compute?  Ans: A neuron computes a linear function (z = Wx + b) followed by an activation function  2. Which of these is the "Logistic Loss"?  Ans: 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?  Ans: ``` pythonx = img.reshape((32*32*3,1))```  4. Consider the two following random arrays "a" and "b": What will be the shape of "c"?<jupyter_code>a = np.random.randn(2, 3) # a.shape = (2, 3)
b = np.random.randn(2, 1) # b.shape = (2, 1)
c = a + b<jupyter_output><empty_output><jupyter_text>Ans: c.shape = (2, 3)  5. Consider the two following random arrays "a" and "b": What will be the shape of "c"?<jupyter_code>a = np.random.randn(4, 3) # a.shape = (4, 3)
b = np.random.randn(3, 2) # b.shape = (3, 2)
c = a*b<jupyter_output><empty_output><jupyter_text>Ans: The computation cannot happen because the sizes don't match. It's going to be "Error"!  6. Suppose you have nxn_xnx input features per example. Recall that X=[x(1)x(2)...x(m)]X = [x^{(1)} x^{(2)} ... x^{(m)}]X=[x(1)x(2)...x(m)]. What is the dimension of X?   Ans: (nx,m)  7. Recall that "np.dot(a,b)" performs a matrix multiplication on a and b, whereas "a*b" performs an element-wise multiplication. Consider the two following random arrays "a" and "b": What is the shape of c?<jupyter_code>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)<jupyter_output><empty_output><jupyter_text>Ans: c.shape = (12288, 45)  8. Consider the following code snippet: How do you vectorize this?<jupyter_code># 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]<jupyter_output><empty_output><jupyter_text>Ans: c = a + b.T  9. Consider the following code: What will be c? (If you’re not sure, feel free to run this in python to find out).<jupyter_code>a = np.random.randn(3, 3)
b = np.random.randn(3, 1)
c = a*b<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1708235294117647, 'fraction_numerical': 0.04423529411764706, 'mean_word_length': 4.507772020725389, 'pattern_counts': {'":': 3, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '437815', 'license': 'MIT', 'n_tokens_mistral': 914, 'n_tokens_neox': 848, 'n_words': 272, 'path': '01.Neural-networks-Deep-learning/Week2/Quiz/Neural-Network-Basics.ipynb', 'repo_name': 'navicester/deeplearning.ai-exercise', 'size': '2125'}