I keep getting name error for the gradient descent exercise
It says that x_train is not defined. Help please!
You have to run all the above cells.
I think you may want to take a look at it so that I can understand better. Could I send you a screenshot?
Can you share your code and error
@Santosh_Kumar8: No, doing that would break the Code of Conduct. Students may not share their code for the programming assignments.
Please post a screen capture image that shows the error message or assert.
I agree with @saifkhanengr, you must run all of the cells starting from the top of the notebook, every time you open the notebook. This is where the assets are imported and the workspace is configured.
Your compute_gradient() code doesn’t return the correct value for dj_dw.
So, what can I do to make it right?
Did you click on the “Click for Hints” link directly below the cell for the “compute_gradient()” function?
Yes, I used the hints. That part where the new variable dj_dw_i is assigned to dj_dw using +=, might give a clue . Something went wrong before then, I guess, I can’t seem to get what went wrong.
Good day. I have run all the cells. It no longer says name error. It’s stuck on the Assertion error. I don’t know what else to do to make it go rightly.
Tips for those who find this thread later.
- Indentation is important in Python code. That’s how it creates blocks of code.
- Division by m should only be done once in the compute_gradient() function.