I am getting error on the Lab that I have submitted for Linear Regression. The entire program is correct and all testing is providing correct data but still after submitting the program it says compute cost function and compute gradient function is incorrect . I tried to refresh the page and via Help menu I tried to get latest lab ( and deleted previous labs) but still no luck. Can anybody help me.
This probably means there are problems with your code in your notebook.
The grader tests your code using different sets of data and different conditions.
Check if your code uses any hard-coded values or fixed size constants.
Then, please post a screen capture image that shows the detailed grader feedback.
This is my cost function code
{mentor edit: code removed}
There is no problem with your compute_cost function (though it has a logical bug in that you’re computing total_cost within the for-loop).
Your indentation is set to eight-spaces per tab, that’s a little unusual. Four spaces is more common. I don’t know if the grader cares about that.
The issue is probably somewhere else in your notebook, and is making the grader crash and throw confusing error messages.
In the future please do not post your code on the forum. That’s not allowed by the Code of Conduct. If a mentors needs to see your code, we’ll contact you with instructions.
Ohh I was not aware of not adding the code. My sincere apologies. and I will keep this in mind. I am taking a look at this and will revert back if I need more help.
Hi - I created entire program from scratch again and I checked all the code and its giving me correct outputs (based on testing that needs to happen in the program). however when I submit the assignment, I am still getting error. The error is same - compute cost and compute gradient function is incorrect. Can somebody please help me with this.
Also when I try to submit my program it still shows me original assignment file name. Is that a reason why the grading is failing ( see screen shot below) ( original file name is C1_W2_Linear_regression. Should it show me 'Assignment_01_Linear Regression which is my file) while submitting the assignment? and If yes how to select my file for submitting the assignment
The grader always uses the original file name.
You cannot grade a notebook that has a modified file name.
It does not matter what name your notebook has when you click on the “Submit” button. The grader is always going to use the default notebook file name.
Ok Thanks. Can somebody help me to sort this out and why the grading is saying that the functions are incorrect (even though they pass all test data checks correctly). This is been going on for few days or a week now and I have tried various things but not sure what’s causing this error in grading.
There are lots of ways to get a 0 from the grader even if your code passes all of the built-in tests. The tests in the notebook do not prove your code is perfect.
First, let’s be sure you’re back to a stable baseline of performance. Please do the following:
- Open the notebook with the default name. That’s the only one that matters.
- Use “Kernel → Restart & clear output”
- Use “Cell → Run All”
- Wait for all of the cells to run.
- Check the results of every cell to see that you get the expected output and that all of the built-in tests pass.
If you see any errors or asserts, post a screen capture image.
Thank you for the help. When you say open the notebook with default name what does that mean.? Is that the file that I created (and that file name) if So I am good. Sorry I am bit new to this so bear with me.
It means “open the notebook that Coursera put in your File area when you started working on this assignment”.
For this assignment, I think that’s “C1_W2_Linear_Regression.ipynb”.
You should not have created any files.
The grader will not use a file that doesn’t contain the required metadata.
Ok I thought we were suppose to create brand new program. Because the instructions in the C1_W1_Linear_Regression.ipynb" says following
*NOTE: To prevent errors from the autograder, you are not allowed to edit or delete non-graded cells in this notebook . Please also refrain from adding any new cells.
so I thought we have to create new program
So are you saying that I should only use C1_W2_Linear_Regression.ipnyb file itself to do this exercise and update that file only for cost and gradient function code cells) instead of creating a new assignment file all together and then submit the assignment? if that’s the case I think we know what the issue is then.
You just have to edit the cells that have a comment block that says “START CODE HERE”.
Be careful you don’t modify anything outside of those areas.
Do not create your own notebook file. The grader will not grade it, because it won’t have the correct internal metadata.
@Avanti_Karandikar It might be helpful to understand the differences between the different types of cells. Some cells (in the notebook) contain code; some cells contain instructions about what we need to do. The NOTE that may have caused your misstep is telling us that we can modify only the cells that contain code (that’s what we get graded on), not any other cells in the notebook.
Thank you @TMosh and @kwiseth for all your help and guidance. I was able to successfully finish this assignment. I have clear understanding of code cell and Markdown cell. However I was not sure whether I had to enter the code in that assignment file itself ( as opposed to creating new program). I learnt so many things in the process though which is important in any learning. Thanks Once again. Appreciate your help.
That’s good news!