I can’t run any code , even codes that i have already executed before , because of this error , and i don’t know how to deal with it .
Now, this is a very interesting error that I have not seen here before. What you have done is you just called the function compute_cost_logistic
again in the same function body this in programming is called recursion.
Many programming languages do support recursion, unlike Python which does support it but with a limit, as it limits the number of recursion calls to 1000 calls.
Now, for the solution, remove the function calls in the compute_cost_logistic
function body remove the recursion, and try using loops to solve it. or a better option tries using NumPy it will be mush easier and in very few lines of code.
Also, after you removed the recursion and started implementing the solution using loops. try following this https://community.deeplearning.ai/t/general-code-debugging-tips/212979 if you still have errors.
Best Regards,
Moaz El-Essawey
That’s really helpful … تسلم يا باشتنا
You’re welcome Ali, I’m glad it helped.
You have deleted a comment line that included the “UNQ_C4” text. That is what caused the issue.
You can refresh your notebook by using the Help menu at the upper right corner of your browser.
If you want to edit your current notebook, here is what that cell should contain:
Perhaps you have hard-coded some value in cell #4 in the notebook, where you should be using a variable.
If you can provide the code snippet for your code to resolve this issue
Note that students cannot share their code on the forum - that breaks the community standards.
What error are you seeing?
Please post a screen capture image that shows the grader’s error message.
I asked for a screen capture image. You provided a text copy-and-paste.
Questions:
Did you modify any of the text inside the first three cells of the notebook? Because my copy of that notebook does not include a \n in that line of code. When I run the first three cells, this is the output:
Also, did you add any new cells to the notebook?
You did not answer my question about whether you added any new cells.
New question - have you re-named your notebook file?
They are not valid Python syntax. I think you have added these things which are not supposed to be added there. Please remove them and don’t change anything else besides adding code for the exercises.
As for the original error that you encountered:
Cell #3. Can’t compile the student’s code. Error: SyntaxError(‘invalid syntax’, (‘/tmp/student_solution_cells/cell_3.py’, 7, 7, ‘Type of X_train:\n’))
I compared it with your last screenshot and I think you had changed something. Please remove the things I mention in above, and try to submit again.
Raymond
Hello @Sana_Eltayeb,
Follow these steps to download a fresh copy of the assignment notebook, keep move only your exercise code from the current one to the new one. This is something a learner can do on their own, so that they can experiment with their notebook with the chance to go back.
Please follow the above suggestion to get a new notebook, move your code, then submit again.
Raymond
That piece of code should come from the notebook and untouched, so if the grader says that line of code has problem, then my suggestion is for you to get a fresh copy again.
You need to rename your current notebook so that the system can get you a new copy. However, for the new copy, you shouldn’t change its name, only move your exercise code to there and then submit.
Raymond
Sorry I do not prefer to login your account. If you like, you can share a screenshot of your current cell #17 here. It shouldn’t contain any assignment code. (Note: to find cell #17, on the menu, click “Kernel” > “Restart & run all”, then follow the number on the left hand side of the code cells until it reaches 17. Then take a screenshot of that cell and any error message beneath it)
Although I can imagine how you are feeling now, we really need to be patient. I know you have done it twice, and I believe no action has come to your attention which corrupted your cell #17, but sometimes it happens unintentionally.
You encountered an error in your cell #3, and you have fixed it. Now there is a similar error in cell #17, and you can fix it too, and you only need to get a fresh copy again. I am sorry you may need to do it for the 3rd time.
Raymond
hah… I am sure the grader doesn’t know you have refreshed the notebook.
I cannot speak for them but I am going to share your post with some people. I don’t know how long you will wait for their response, or whether their response will be different from my following and repeated suggestion, but if you want to fix it, then please (1) refresh your notebook, (2) copy your exercise work, (3) don’t change anything else, (4) do everything on coursera workspace and NOT on your local workspace. You are not the only one who fixed problem like that by refreshing it. You have refreshed it twice, but I have asked and seen at least tens of learners fixed their problems by refreshing the notebooks.
Raymond
You cannot submit a re-named notebook. The grader always uses the original default notebook file name.
The file name of the notebook file you have open does not matter when you push the Submit button. It will always grade the default named notebook.
Yes, I noticed that.
What shall I do then?
To not rename the file?
Can you please ask the course orgnizer to update and reset the notebook for me?
So I can restart again to finish the assignment from sctratch? Is that would be possible from you as a Super Mentor?
Thank you for your understanding!
Best regards
So I should delete and refresh the file??
NOT to rename it?
Is that would be right?