C1W3_lab_Logistic_Regression"code cannot be edited

Hello has anyone encountered this issue like I did? The issue is “NameError: name ‘plot_decision_boundary’ is not defined” for a cell that is not designed for students to code for exercise/tests. This caused the grader keep outputing “Cell #25. Can’t compile the student’s code. Error: ValueError(‘x and y must have same first dimension, but have shapes (2,) and (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2)’)” even though I have passed all the exercises’ cells. And the this cell CANNOT be edited. Any idea of what’s problem of this and how to fix it?


Have you run all the previous cells including the imports at the top?

Those look like two completely different problems. Gent has given you the answer for the second one. For the errors from the grader, there must be a bug (or bugs) in your code that you will need to find. Unfortunately the errors sometimes hard to track down to the particular line of code. You can try using the “Cell #25” as a clue. Note that to get consistent numbers for the cells, you have to execute from a clean state as in:

Kernel → Restart and Clear Output
Cell → Run All

Then look carefully at the cell numbers shown on the left column with the output.

1 Like

Yes I ran through from the top ‘import’ cell.

The other cells all were tested for a correct pass check. The tricky part here is this bugging cell doesn’t allow to edit. Or I can give it a try to see if I can locate the bug.

Yes, the test cells may not be editable. If the test fails, the solution is not to change the test: it is to find the bug in your code that is triggering the test failure.

If what you are saying is that all the tests pass in the notebook, but then the grader fails, that most likely means that there is some way in which your code is not general. Meaning that you have hard-coded the solution so that it matches the expectations of the tests in the notebook, but fails when the grader uses a different test case. One example of that type of bug would be referencing global variables instead of the parameters passed to your functions.

1 Like