Issue with C1_W3_Logistic_Regression assignment in course Supervised Machine Learning: Regression and Classification

I am currently enrolled in the Coursera Machine Learning Specialization by Andrew Ng. In the course titled “Supervised Machine Learning: Regression and Classification”, I’ve encountered an issue with the final lab assignment of Week 3, specifically in Exercise 4 of the C1_W3_Logistic_Regression notebook.

In the section where I am instructed to compute the training set accuracy, the code cell is locked and cannot be edited. When I attempt to run it as is, it throws an error, preventing me from completing the assignment and resulting in a score of zero.

The error occurs in exercise 4, second part where the task is to compute the accuracy of the training set. The info before the cell says “Now let’s use this to compute the accuracy on the training set”. I am unable to make any changes to this coding cell, and when I run it in its natural state it gives an error. This is leading to me getting a 0 in the assignment. "

Its better to post a screenshot of whatever error you get when trying to run that cell, or the screenshot that you cannot run it at all!

Normally if a problem happens with the notebook in the Lab you would perform Kernel → Restart and then run all cells from top again!

When a locked cell gives an error, it almost always means that the cell is calling a graded function that you have updated, and that code does not work correctly.

The locked cells don’t have errors - they’re used for testing your code (or as gent.spah noted, they’re used for setting up the workspace).

The grader input for me getting a 0 is states as follows: “Comment line with index: UNQ_C4 is duplicated”

From what I could deduced it is because of the code cell which is shown in the images I uploaded. The two images show cells from exercise 4 on the assignment. I am able to make edits to one of the cell (The 2nd picture) but for the cell in the first picture I cant make any changes even though the cell has a section where code needs to be filled for it to run.

Also the reason I mentioned the graders give me, as its clear that the Comment line with index: UNQ_C4is present in both cells, and one of these cells doesnt allow me to make any changes. I would like to emphasize that both cells have a section where I need to enter code for the cell to run properly

You are not supposed to post full solution here on public!

What is this part at the beginning of the function doing?

It seems to me that your python skills are not adequate for this specialization yet, I would suggest taking a course on python first.

1 Like

You appear to have made several incorrect modifications to your notebook, and now it is broken.

I recommend you delete your notebook and get a new copy and start over.

Use the File → Open menu, select the notebook file, and the click on red Trash Can icon.
Then use the Lab Help menu (the question mark inside a circle, on the right side of your browser), and then use “Get latest version”.

Then you’ll need to use the File->Open menu, and open the new copy of the notebook.

This time, do not make any unnecessary changes to the notebook.
For example:

  • don’t add cells
  • don’t move cells
  • don’t delete cells
  • don’t add code outside of the marked areas.
  • also, do not rename your notebook ipynb file.
1 Like

I cant make changes to the cell, so its not me who has written anything here.
Still thanks for the help

Yeah I did this now for some reason the new version has no exercise 4.
Thanks for the advice, I think I should be able to do the assignment now.

Perform “Get Latest Version” what Tom has mentioned above to get a clean copy of the assignment and the start over again!

It’s possible you were working from an obsolete version of the assignment.

Yeah that appears to be the case, I had taken the course a year or so ago and hadnt done this assignment. Had done a part of it. Took the course again to finish it and started where I left off. Your suggestion worked and doing it from scratch helped me finish it. Thanks to both u and @gent.spah .

2 Likes