Week 2 Assignment - Assertion Error

Hello! I’m stuck with the assignment - applied everything required, checked the hints, everything looks correct and got right answers. But! The checking code show an Assertion error and the grader does not accept the solution. Anybody from the team can help me?
Lab ID is wgfbsids

Hey @Sergey_Chetvertakov,
Welcome to the community. Unfortunately, the code that you have written is only passing the tests written in the notebook, and not the public tests, and that’s why the Assertion Error. Please go through your code carefully once again, perhaps you can try to reason about the output that your code for the compute_cost function produces in the case of perfect predictions, which could reveal the error to you. But if not, please do DM your code for the compute_cost function to me, and I will help you out. For DM click on my name and select “Message”.

P.S. - Posting solutions in the public forums is strictly against the community guidelines. So, please refrain from doing so.

Cheers,
Elemento

1 Like

Encountering a similar issue. Arrive at the expected answers but the grader is not accepting my code. Can you please assist?

It was worth asking - I’ve found the solution myself. The issue was that I had to change x and y variables to the variables’ names imported with the database, not only in the space ### START CODE HERE ###, but also in the part of the code provided in the notebook (that I thought should not be changed).

Hey @Sergey_Chetvertakov,
I am glad you were able to find solutions by your own. By the way, you are not supposed to modify any code outside of “### START CODE HERE” and “### END CODE HERE”. If you have done this to pass the test-cases, then this will most likely be rejected by the auto-grader, and this means that your implementation is incorrect.

Hey @Kingsley_Okiwelu,
Is your code passing all the test-cases, including the ones written in the notebook as well as the public ones? If yes, and the grader is still not accepting your code, then it means that your implementations are failing the hidden test-cases. This most frequently happens when you hard-code some values instead of using their associated variables. Try to figure out if you have used hard-coded values at any place instead of using variables. If you are unable to figure it out, then please DM your notebook to me, and I will help you out.

Cheers,
Elemento

I’m afraid, I have hopelessly edited the code in the original notebook containing the question. This was done in ignorance as I’m still sort of a python newbie. Unfortunately, I can’t retrieve the original version of the lab questions so I can start afresh without tampering with any of the code that should not be edited. How do I proceed?

Hey @Kingsley_Okiwelu,
Please check out 09 of this thread.

Cheers,
Elemento

@Kingsley_Okiwelu , please see your other thread where I posted a reply.

Thanks for your prompt response found this helpful. However I’m now stuck in exercise 2 of the week 3 practice lab. I’m getting an output of 0.007 for my w-parameter value derived from the compute_cost function instead of 0.693. I’ve checked and re-checked my code but am still nonplussed as to where the error is coming from. Can you please assist?

Sorry, I am not able to reply at thus time. Please post a new thread.