Continuing the discussion from Error in week 2 lab assigment:
Hey @KAILASHPATI,
Welcome to the community. The error message clearly indicates that your implementation of compute_cost
is erroneous. Have you taken the square of the error, before averaging the errors to get the total cost?
Cheers,
Elemento
Hi @KAILASHPATI
In addition to what Elemento said the code is do a loop over the training set do you have(m) in every iteration you compute the prediction = wx[…]+b after that you subtract the prediction minus the real value and compute the square of the result and doing summation finally before the return you divide the summation value over 2 training set do you have(m) .
also you can implement the code without the loop but by doing the vector multiplication.
you can check the hint below
Cheers!
Abdelrahman