Deep learning course week2

I’m in week 2 and attempted to do graded assignment but I got 50% cause of data errors in my assignment. How do I troubleshoot below
[ValidateApp | INFO] Validating ‘/home/jovyan/work/submitted/courseraLearner/W2A2/Logistic_Regression_with_a_Neural_Network_mindset.ipynb’
[ValidateApp | INFO] Executing notebook with kernel: python3
[ValidateApp | ERROR] Timeout waiting for execute reply (30s).
[ValidateApp | ERROR] Interrupting kernel
[ValidateApp | ERROR] Timeout waiting for execute reply (30s).
[ValidateApp | ERROR] Interrupting kernel
Tests failed on 3 cell(s)! These tests could be hidden. Please check your submission.

The following cell failed:

w =  np.array([[1.], [2]])
b = 1.5

# X is using 3 examples, with 2 features each
# Each example is stacked column-wise
X = np.array([[1., -2., -1.], [3., 0.5, -3.2]])
Y = np.array([[1, 1, 0]])
grads, cost = propagate(w, b, X, Y)

assert type(grads["dw"]) == np.ndarray
assert grads["dw"].shape == (2, 1)
assert type(grads["db"]) == np.float64


print ("dw = " + str(grads["dw"]))
print ("db = " + str(grads["db"]))
print ("cost = " + str(cost))

propagate_test(propagate)

The error was:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-14-a16910aa3a0e> in <module>
     17 print ("cost = " + str(cost))
     18 
---> 19 propagate_test(propagate)

~/work/submitted/courseraLearner/W2A2/public_tests.py in propagate_test(target)
     49     assert type(grads['dw']) == np.ndarray, f"Wrong type for grads['dw']. {...
     50     assert grads['dw'].shape == w.shape, f"Wrong shape for grads['dw']. {gr...
---> 51     assert np.allclose(grads['dw'], expected_dw), f"Wrong values for grads[...
     52     assert np.allclose(grads['db'], expected_db), f"Wrong values for grads[...
     53     assert np.allclose(cost, expected_cost), f"Wrong values for cost. {cost...

AssertionError: Wrong values for grads['dw']. [[-1.04614847e+00]
 [ 7.42792019e+02]
 [-2.61191072e+03]] != [[-0.03909333]
 [ 0.12501464]
 [-0.99960809]]

==========================================================================================
The following cell failed:

params, grads, costs = optimize(w, b, X, Y, num_iterations=100, learning_rate=0.009...

print ("w = " + str(params["w"]))
print ("b = " + str(params["b"]))
print ("dw = " + str(grads["dw"]))
print ("db = " + str(grads["db"]))
print("Costs = " + str(costs))

optimize_test(optimize)

The error was:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-16-3483159b4470> in <module>
      7 print("Costs = " + str(costs))
      8 
----> 9 optimize_test(optimize)

~/work/submitted/courseraLearner/W2A2/public_tests.py in optimize_test(target)
     73     assert type(costs) == list, "Wrong type for costs. It must be a list"
     74     assert len(costs) == 2, f"Wrong length for costs. {len(costs)} != 2"
---> 75     assert np.allclose(costs, expected_cost), f"Wrong values for costs. {co...
     76 
     77     assert type(grads['dw']) == np.ndarray, f"Wrong type for grads['dw']. {...

AssertionError: Wrong values for costs. [array(5.80154532), array(nan)] != [5.80154...

==========================================================================================
The following cell failed:

from public_tests import *

model_test(model)

The error was:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-20-9408a3dffbf6> in <module>
      1 from public_tests import *
      2 
----> 3 model_test(model)

~/work/submitted/courseraLearner/W2A2/public_tests.py in model_test(target)
    131     assert type(d['w']) == np.ndarray, f"Wrong type for d['w']. {type(d['w'...
    132     assert d['w'].shape == (X.shape[0], 1), f"Wrong shape for d['w']. {d['w...
--> 133     assert np.allclose(d['w'], expected_output['w']), f"Wrong values for d[...
    134 
    135     assert np.allclose(d['b'], expected_output['b']), f"Wrong values for d[...

AssertionError: Wrong values for d['w']. [[ 0.29990323]
 [-0.29787607]
 [-0.40824175]
 [ 0.42667634]] != [[ 0.08639757]
 [-0.08231268]
 [-0.11798927]
 [ 0.12866053]]

Have you seen this faq on posting and this faq on moving a post ?

I see, you have failed multiple exercises (Ex. 5 and onward).
First, let’s focus on Ex. 5 propagate. Your error for this exercise is:

AssertionError: Wrong values for grads['dw']. [[-1.04614847e+00]
 [ 7.42792019e+02]
 [-2.61191072e+03]] != [[-0.03909333]
 [ 0.12501464]
 [-0.99960809]]

So, check that equation, dw, and all the other equations that can influence the dw, like cost.

I recommend you not submit your notebook for grading until you have passed all of the notebook tests and obtained all of the Expected Output values.

1 Like