Hello Gerardo,
Your code for C2 is incorrect/incomplete. I am sharing screenshot of the hints which is mentioned just below the grader cell to make your code correct.
UNQ_C2
GRADED FUNCTION: compute_cost
def compute_cost(X, y, w, b, *argv):
If you are still running into error, let me know.
Remember the loss_sum is the label in a labeled example. Since this is logistic regression, every value of must either be 0 or 1. In your case you have not initialise loss_sum=0. See the hint images, you will understand.
ERROR IN C3
Also for C3 where you have mentioned f_wb = sigmoid(z_wb) is incorrect as you have initialise z_wb to 0 in the initial line of code
Did you read this before C3 cell
So here for
f_wb apply sigmoid function to the both parameters with the number of examples and while applying sigmoid function remember this hint
As you are doing this, remember that the variables X_train and y_train are not scalar values but matrices of shape ( 𝑚,𝑛 ) and ( 𝑚 ,1) respectively, where 𝑛 is the number of features and 𝑚 is the number of training examples.
-
This code is incorrect. Use hint section to make this code one line.
for j in range(n):
dj_dw_ij = (f_wb - y[i])* X[i][j]
dj_dw += dj_dw_ij -
At the end divide dj_db and dj_dw by total number of examples
dj_dw = dj_dw / m
dj_db = dj_db / m
Regards
DP


