I realized that in the test sets defined in the compute_cost_reg_test(target)
function, one of the cases has y values [0.5] * 8. (Considering that this is binary logistic regression algorithm, y value should be 0 or 1, I think).
I calculated the total_cost inside the compute_cost function using np.where(y==0), or np.where(y==1) method under the premise that y value is always either 0 or 1.
Both the compute_cost function and compute_cost_reg function got correct when I submitted the assignment, but I wonder whether we we should consider the cases where y might have a value other than 0 or 1,
and if it is, I’d like to know the example cases and whether there’s something different from how we derived the cost function.
I am quite confused with this now, so if anyone could help me, I would really appreciate it. Thank you very much.