I am not getting the right piece of code for w and b.
Idea i have in mind is that the (argument train_x_flatten.shape,1) is what we initialize w by using np.zeros
and for b it is without 1 from above argument.
somehow is it not executing …
and i also have assertion error as b in my case is ndarray and i need to convert in float
np.ndarray.astype is not working here.
can someone guide please.
Yes, you need to follow the directions that the error message gives you. Using np.zeros to set the value of b results in a numpy array as the data type, which fails that test. So you have to use a simple assignment statement with a python scalar value on the RHS of the assignment. But notice there is a subtlety there also: the assert checks that the type of b is floating point, not integer. As a hint: in python 1 and 1. are not the same thing: the former is an integer, but the latter is a floating point value. See the difference? Of course 1 is not the value you want here in any case, but you get the point (no pun intended) …
Thank you for your quick reply, so it means b will be always a hyperparamter floating scalar value?
Yes, in this particular case. But that is true only for Logistic Regression: when we get to full Neural Networks in Week 3 and Week 4, the bias b becomes a vector of floats at each layer.