I have passed all the cell tests
Yet the grader indicates an error in Cell #29.
It means there is something wrong with your compute_cost_reg
function. Maybe you hard-coded some parts of your code. Why not check with a hint?
I am sure I haven’t hardcoded any part, all the other tests pass, while running all the cells, it doesn’t cause any error anywhere, but only on submission, did I get this error.
Passing the tests in the notebook does not prove your code is perfect.
The grader has different tests.
I understand, the error indicates that I have made an error using the wrong index, that I cannot access the 27th index in a 27-long array, and I have to use a different variable in the range function such that I don’t try to access the 28th element. I have cross-checked the hint with my code. I approach the problem in a similar fashion. i sure use the same range in for loop.
Have you checked the compute_cost
function? It is also used in compute_cost_reg
.
compute_cost
works without any issues. I have cross-checked it with the hint and it seems to have no errors
If you count the executable cells in the notebook, what code is in the 29th cell?
The cell attached in the photo
It appears to be a test cell
Click on my profile and send me a screenshot of compute_cost_reg function code via DM.
Just to finish this conversation, I want to say that this issue has been solved.
@Mujassim_Jamal, can you summarize what the issue was? It might help other students who find this thread.
Sure!
Learner made an error by including the unnecessary line “fb=np.dot(w, X[n])
” above the for loop in the compute_cost
function.
Specifically, the issue arose due to the presence of X[n] when a test case might have a value for m and n where m <= n.