Deep Neural Network - Application C1W4

Hello! Im having an issue when running the two_layer_model function that I’m not able to understand. I attach my code and also the error.

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not)

error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-45-f9ec5304d38d> in <module>
----> 1 parameters, costs = two_layer_model(train_x, train_y, layers_dims = (n_x, n_h, n_y), num_iterations = 2, print_cost=False)
      2 
      3 print("Cost after first iteration: " + str(costs[0]))
      4 
      5 two_layer_model_test(two_layer_model)

ValueError: too many values to unpack (expected 2)

How does your compute_cost(A2, Y) look like?

Hi! In which part it should be?

It should be up in your code cells, you can search it by pressing: control + F, then write: compute_cost(A2, Y)

Do you mean this? Is the only place I see it, but its also in the code I had attached before

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not)

My best guess is that the problem comes from there, you can very this by obtaining the shape of “cost”, which should not be different than 2. You can do this by writing:
print(np.shape(cost))

The compute_cost() function in this assignment is provided code, the student does not need to create or modify it.

It’s provided in the dnn_app_utils_v3.py file.

Have you tried running all of the cells again in sequence, starting from the first cell at the top of the notebook?

Also, just a reminder: Please do not post your code on the forum. That’s not allowed by the Code of Conduct.

If a mentor needs to see your code, we’ll contact you with instructions.