C1_W3 wrong output

I am doing the final test in week 3 course 1. I got the error:

~/work/public_tests.py in compute_cost_reg_test(target)
91 expected_output = target(X, y, w, b, lambda_)
92
—> 93 assert np.isclose(expected_output, 0.5469746792761936), f"Wrong output. Expected: {0.5469746792761936} got:{expected_output}"
94
95 w = np.random.randn(5)

AssertionError: Wrong output. Expected: 0.5469746792761936 got:0.5855062160376726
My compute_cost_reg function is:

{mentor edit: code removed

I can not find what is wrong in my code. I think it followed the formula well. Can anyone please help me?

A reminder: Please do not post your code on the forum. The Code of Conduct does not allow it.

If a mentor needs to see your code, we’ll contact you with instructions.

Hint:
Inside your for-loop, if ‘w’ is a vector, you need to index it with ‘i’.


I’m getting this error when trying to define the y train. I’ve tried to remove the periods and it doesn’t seem to help. For the second exercise

Try separating the elements with commas. That’s the syntax for creating a list in Python.

But I do not think you are supposed to create your own array for y_train.

Within the functions, the local variable name is ‘y’.


I’ve taken away the variables but now im left with this error and im nit sure what it is referring to No worries if I’ve asked to much already thank you for your help!

It means either the variables i or j have an incorrect value.