Programming assignment on week 2

Hi need help as all the test cases passed for assignment on Optimization Methods but I am still getting grade 88/100.

The test cases in the notebook do not catch all possible errors. This means you still have some debugging work to do. Unfortunately the grader is not very helpful in these cases and frequently refuses to even tell you which section is at fault. Are you sure you clicked “Show grader output” to see the full details of its feedback? It may not help much, but at least we have to start there. If you’re lucky, it will say something like this which would tell us which function has the problem:

[ValidateApp | INFO] Validating '/home/jovyan/work/submitted/courseraLearner/W2A1/Optimization_methods.ipynb'
[ValidateApp | INFO] Executing notebook with kernel: python3
Tests failed on 1 cell(s)! These tests could be hidden. Please check your submission.
==========================================================================================
The following cell failed:

    parametersi, grads, vi, si = update_parameters_with_adam_test_case()
    
    t = 2
    learning_rate = 0.02
    beta1 = 0.8
    beta2 = 0.888
    epsilon = 1e-2
    
    parameters, v, s, vc, sc  = update_parameters_with_adam(parametersi, grads, vi, si,...
    print(f"W1 = \n{parameters['W1']}")
    print(f"W2 = \n{parameters['W2']}")
    print(f"b1 = \n{parameters['b1']}")
    print(f"b2 = \n{parameters['b2']}")
    
    update_parameters_with_adam_test(update_parameters_with_adam)

The error was:

    ---------------------------------------------------------------------------
    AssertionError                            Traceback (most recent call last)
    <ipython-input-13-fb9df09bb7f1> in <module>
         13 print(f"b2 = \n{parameters['b2']}")
         14 
    ---> 15 update_parameters_with_adam_test(update_parameters_with_adam)
    
    ~/work/submitted/courseraLearner/W2A1/public_tests.py in update_parameters_with_ada...
        257         assert type(parameters[key]) == np.ndarray, f"Wrong type for parame...
        258         assert parameters[key].shape == parametersi[key].shape, f"Wrong sha...
    --> 259         assert np.allclose(parameters[key][0], expected_parameters[key]), f...
        260         #print(f"{key}: \n {str(parameters[key])}")
        261 
    
    AssertionError: Wrong values. Check you formulas for parameters['W1']

Hi, @Megha_Sahay.

Did you pass the assignment?

There was just a small problem with the indexes in random_mini_batches .

1 Like

Yes I did pass the assignment but did not score full marks.

You had already fixed the expressions for s["dW" + str(l)] and s["db" + str(l)], hadn’t you? :thinking:

1 Like

Thank you for the clue! I had the same problem, and after some pen and paper checking I found my error with the indexes.

1 Like