# Compute_cost_reg_test function in public_tests.py (C1_W3_practice lab)

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.

By convention, the ‘y’ values should be either True (1.0) or False (0.0). So I think that’s an unrealistic test. I’ll report it to the course authors.

However, using np.where() is not a good idea, because the equations for the cost should work mathematically for any values of ‘y’. Your decision to write your code based on the assumption of only values 0 or 1 is not recommended.

Thank you very much for clarifying this and the advice that the code for cost should work mathematically for any values.
Thank you