Hello everyone, ı am new boy around here
, Need to talk about first course week 4 last assignment, ı fılled cells what need to be dırected for me, but in the 2 layer and N layer model situation ı got same error type. Could anyone can help.
ValueError Traceback (most recent call last)
in
----> 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)
It looks like you must have changed the “return” statement in the two_layer_model function. That is part of the template code that was given to you and there should be no need to modify it. Why did you change that line? If you “copy/pasted” the entire function from an earlier version of the course (pre April 2021), then please be aware that doesn’t work: many things changed in April 2021.
There is a procedure documented on the FAQ Thread to get back to a clean copy of the notebook for comparison purposes.
1 Like
Thank you so much sir,the problem was solved first i open a clean notebook as you said in "how can ı restard notebook " something like that , issue and than i typed as notebook want to how in like directory and ı solved it.
Thank you have a nice day
hi dear still cant understand what are the problem can someone explain for me am going crazy i know its something small but i cant see it any more
It looks like you have exactly the same problem that I answered on this previous reply on this thread.
You must have copied that function from an old version of this notebook. They changed the definition of the model functions in April of 2021, so it does not work to copy the old solution. Here’s what the last few lines of the template code for L_layer_model
should look like:
# Print the cost every 100 iterations
if print_cost and i % 100 == 0 or i == num_iterations - 1:
print("Cost after iteration {}: {}".format(i, np.squeeze(cost)))
if i % 100 == 0 or i == num_iterations:
costs.append(cost)
return parameters, costs
Notice that it returns two values. So why does your code return only one? Please follow the instructions I gave in the previous reply that I linked and then proceed from there.
It’s possible that you started taking the course before April 2021 and have a saved version of your own work. But if you just tried to copy a solution from the Internet, please understand that is against the rules. And it also doesn’t work if you copy an old one. 