Failed test case: Exception during compute_cost_reg

Failed Test Case error during C1 W3 final graded lab on DL.AI platform.

image

Code works fine as outputs passes test. But during final submission throws attached error.

I have tried bunch of things like restarting the kernel. Using np. module instead of math seemed to have fixed 4 out of 6 exercises.

Any help will be greatly appreciated.

The grader does not expect you to use the math package.

The grader uses different tests, and does not run your notebook as-is. It extracts your code into a different runtime environment.

Try another method. Do not import any other packages.

importing numpy module in Exercise 2 code made it work. Exercise 5 was calling compute_cost from exercise 2 which worked as well after.

Thanks!

Do not import any modules inside your exercise code.
That might make the grader happy, but it is entirely not necessary.

All of the necessary packages were imported by the first cell in the notebook.
Do not import anything else.

2 Likes

You can see that numpy was already imported here:

So importing it again in any other cell is not useful or necessary.

(previous discussion deleted, please read the “update” reply below)

1 Like

Update:
Some of the MLS courses on the DL.AI Learning Platform will use numpy in the example code, but they do not allow access to numpy functions if you put them in your solution code.

I’ve submitted a support ticket to update the grader to allow use of numpy functions.

Until the grader is updated, I recommend that learners NOT use numpy functions in their solution code for the MLS courses on the Learning Platform.