C1_W2_Linear_Regression- error

I am keep getting this error

AssertionError Traceback (most recent call last)
6 print(‘Gradient at initial w, b (zeros):’, tmp_dj_dw, tmp_dj_db)
----> 8 compute_gradient_test(compute_gradient)

~/work/public_tests.py in compute_gradient_test(target)
50 dj_dw, dj_db = target(x, y, initial_w, initial_b)
51 #assert dj_dw.shape == initial_w.shape, f"Wrong shape for dj_dw. {dj_dw} != {initial_w.shape}"
—> 52 assert dj_db == 0.0, f"Case 1: dj_db is wrong: {dj_db} != 0.0"
53 assert np.allclose(dj_dw, 0), f"Case 1: dj_dw is wrong: {dj_dw} != [[0.0]]"

AssertionError: Case 1: dj_db is wrong: 10.980464948453609 != 0.0
Not sure where I did the mistake. Any help is appreciated

1 Like

Hi @Krishnayalla
Welcome to the community!

Make sure that you upadte the variable dj_db as I think that you are did right with dj_dw but dj_db you didn’t change it according to this equation

Thank you for you response. I was able to fix the error.

1 Like

can anyone explain how ill i submit my entire notebook that i have made possibly. and if i should not upload it how should i submit my solution to thsi linear regression model problem

1 Like

You can submit your assignment by pressing submit button as shown in the below image.

If submit button is not appearing in your notebook, read this.


but its not showing my file its only showing the example file for submission

1 Like

It is OK. Just press the check box and then submit.

But make sure you did your code in this file.

Ooh ok thanks a lot for the help

1 Like

Cell #UNQ_C1. Can’t compile the student’s code. Error: IndentationError(‘unexpected indent’, (‘/tmp/student_solution_cells/cell_7.py’, 31, 4, ’ for i in range(m):\n’))

does anyone what this error means.

1 Like

It means you have some extra indentation in cell # UNQ_C1. Use Ctrl + f to find UNQ_C1, in that cell, see where is extra indentation (just Python skills).

is their to restart the notebook with fresh new code lines beacuse i messed up up some of the old code and o dont know how to recover.

1 Like

Here is the guide.

now i am getting this error message from this cell any idea on solving it

You have to run all the above cells, every time you open your assignment.

thanks for the help i have the got the solution for this problem

I am facing this issue and getting below error
ode Cell UNQ_C1: Function ‘compute_cost’ is correct.
Code Cell UNQ_C2: Function ‘compute_gradient’ is incorrect. Check implementation.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors

below is my code

please suggest @saifkhanengr @AbdElRhaman_Fakhry @Siddhartha_Mukherje1 if you can guide please

This is Week 2 assignment? Kindly do not share codes on public posts, rather share the output result or the error you have encountered while running a grader cell. Posting grader cell codes on public post are against community guidelines.

your codes are correct but position of
dj_dw /= m
dj_db /= m

is incorrect. Please press enter and position these two codes lines at the beginning of line as per the for statement code and run the cell again.

P.S. Remove that image.


Apologies i have removed the picture … when u say position these codes at the begining of the line … where do u exactly mean by that ?