Assertion Error; Results still Match

The assert says that your code does not give the correct cost for the case where the predictions are exactly the same as the ‘y’ values.

In the function compute_cost(x, y, w, b) that you defined, check if you accidentally used x_train and/or y_train instead of the local variables x and/or y. This could make your result matches with that in the single test case but fail a more generalized test.

1 Like