RE:ML C1-W2 Programming assignment

Hey there…In ML C1 W2 1St Programming assignment I keep getting below errors. Can you help me out!
Please note that I am not too familiar with Jupyter notebook.

Here’s Images of error

For the first error, check whether your compute_cost() function returns a single scalar value.

For the second error, it looks like you did not run the cell that contains the compute_gradient() function definition.

Please elaborate first problem solution.

Fir second suggestion am getting below error
{Moderator’s Edit: Solution Code Removed}

Hey @Rohan_Nanegali,

Please ensure that your compute_cost function returns a single/scalar value, and not a list/vector of values.

For the second one, I think the error is pretty straight-forward. You have used wrong python syntax in the indicated line of code. It is supposed to be:

for i in range(m):

If you are new to Python, then check out 03 of this thread. I hope this helps.

P.S. - Posting code publicly is strictly against the community guidelines. If a mentor needs to take a look at your code, (s)he will ask you to DM it.


Hello There,

For Collaborative Filtering Recommender Systems Lab Assignment?

I am getting this error for test_cofi_cost_func(cofi_cost_func)

AssertionError: Wrong value. Expected 27, got 540.0. Check the regularization term

Please elaborate on this 20 times anamoly.


Hey @Hemendra_Pal,
Welcome to the community. You are not supposed to post your queries in any existing post randomly. This might lead to your query being neglected. If you can’t find an existing query related to yours, then we would urge you to make a new post specific to your query in the appropriate forum. For more information regarding this, refer to 01 of this thread.

Now coming to your query, this anomaly clearly indicates that your implementation of cofi_cost_func is wrong. Please DM your code for the same to me. For learning how to DM, please check out 15 of the above-mentioned thread.