Course 1 W2 Expected Outcome


when runing the test codes, i get outcomes different from
the expected ones.

for the cost at initial w, i got 9.152 instead of 75.203 and for the gradient descent i got Gradient at initial w, b (zeros): -79.467621016 -11.812299999999999 instead of 65.32884975 -5.83913505154639.

what should i modify to get the expected outcomes?

Hi @Kazoule Maybe you can check the formula and try to compare with the lectures and see what’s not matching. It seems that the error came from the way you set the formula to compute the values.

even if you pass, in my case I passed all test cases but apparently there are test cases which the grader has which aren’t checked in the notebook, mine passed all the test cases but got 0% on the grade for some reason which no-one is able to tell me why, since these are just math equations, not like I am trying to sanitise inputs Error on submission - #9 by SalmanMKC

Hi @SalmanMKC The way grade assignments work is by incorporating different cases to evaluate your code rather than the solution, this is because we need to evaluate the code and not the specific answer to make sure the code is correct and in different situations you’ll be able to came up with the answer.

A good approach that I often follow is:

  • Try by myself several times
  • Try to debug the code and see if it can be done in different problems
  • Check the lectures again and see if you missed something
  • Search online if I still don’t understand

If none of these steps work, check the hints and try to understand and compare with your answer, you’ll learn a lot in the process, and it will help you to develop problem-solving skills.

Let me know if this helps.

Hello @Kazoule!! Su here! :slight_smile:

I recommended looking through the lesson resources & cross check as to whether you made any tiny mistakes. Those pesky little details such as how you assigned/set your formula can give rise to a different output.


i submitted my work and i got 100% even though the outcomes are different from the expected.

sorry, it worked if I put the code in the right file, I was not submitting my code since it was in a different file and the original submission file did not have my code in it

Hello @SalmanMKC,

Again, thank you for sharing your solution with us!