Can we lock this chat to check the code? I really do not understand why I am getting the errors. I have run each cell independently for each line of code.
We cannot lock this chat but we can use the private message option to check the code. However, it is not necessary yet.
Are you running all the cells sequentially? Try Kernel → Restart and run all. Have you deleted/modified any pre-written code or cell? If so, please read this guide to get a fresh copy of your assignment.
Ok, I will get a fresh copy of the assignment. Can I send you my code in a private message? Honestly, I do not understand what I am doing wrong. I have gone back and watched videos again, however, I keep failing one test or all tests.
Right, check the previous cells to find where “np” is defined. You should find this statement:
import numpy as np
in one of the previous cells, right? If not, then it means you’ve modified the notebook in ways that you were not supposed to. In that case, you need to do the “get a clean copy” procedure that Saif linked for you.
If you do find that statement, then you need to run the cell containing that statement in order for “np” to be defined. The simplest thing is to highlight your failing test cell and then click “Cell → Run All Above”. That will run all the previous cells, including the one that imports numpy.
You need to do this every time you open the notebook, even if you had run it the last time. You lost all the “runtime” state anytime you close and reopen or do “Kernel → Restart”.
If you’re new to using Jupyter notebooks, there is a fair amount to get used to here. If you thought you were saving time by skipping the lecture titled “A Quick Intro to the Jupyter Notebooks”, perhaps that is worth another look. There is also a reading topic in Week 2 titled “Programming Assignment FAQ” that is worth a look.
If you have followed @saifkhanengr instructions and still running into error for this section.
Things you need to check:
If all your previous cell test have passed. if not then check the most traced back grader cell for mistakes.
Also for the concern error what I can see there should 2 line codes, so I hope you use the hint mentioned before the grader cell.
You often code this function in two steps:
Set s to be the sigmoid of x. You might find your sigmoid(x) function useful.
Yes, there are several ways to write the python. But I think you’re missing the point of what Saif and I have been talking about: you have to correctly understand what the error message is telling you. It’s not complaining about your code yet: the error happens in running the test cell where it is defining the input that will be used to test your function. And the error is that you have not yet imported numpy as “np”, so the name “np” is undefined.
Please read my previous response again with what I just said in mind.