First you want to compute an y-hat(prediction = XW+b) after that you should subtract y from y-hat and doing doing mean square error(y - y-hat)**2 after that you got a vector you should doing sum of this vector by for example output =np.sum((y - y-hat)**2 ) or by for loop , finally you should divide this output by 2m (number of samples) to get the mean error
this photo show you the implementation in mathematical notations
note(there are many techniques you can do this cost function like using vectorizations or using for loop …etc)
please feel free to ask any questions,
Thanks,
Abdelrahman
@Bita_Bayat,
It’s interesting that you’re getting the message “All tests passed!”, which means the tests in compute_cost_test() passed, but you’re getting a different number than expected when you call