Week 3 : Planar_data_classification_with_one_hidden_layer

Hi! I am a bit confused as I am feeding the right parameters but still I am getting the error in nn_model.

TypeError: compute_cost() takes 2 positional arguments but 3 were given

Hi @Anitya_Gupta,

Can you share your lab ID with me ? So I could help you out. In the assignment, when you click the top right “Help” button, a panel will open and your lab ID will be shown at the bottom.

I shall take a look.


Hi! I closed my notebook yesterday @Mubsi now when I am trying to open its giving me the new notebook

The error message seems pretty clear, doesn’t it? You must be passing three arguments to the compute_cost function, but it is defined to only take two arguments. This should be pretty easy to see if you simply examine your call to compute_cost in the nn_model function.

I am passing the 2 parameters and I checked 3 times @paulinpaloalto sir.

Please show us the actual exception trace that you are getting.

When you open the assignment, click on “File → Open…”, when the workspace loads, you should see your old notebook as well. @Anitya_Gupta

@Mubsi here is lab ID: rabptagw

Hi @Anitya_Gupta,

All should be well now in your notebook.


May I ask what the problem actually was? Was it or wasn’t it a case of invoking the function with 3 arguments instead of 2?

Hi @paulinpaloalto,

Unfortunately, I do not remember what exact issue I encountered here. I helped a few students in a single go, everything is mixed up in my head. I can’t quite recall it.

Function not invoking with 3 arguments was an issue @paulinpaloalto

Thanks, @Mubsi. It really helped and now working