In the second programming assignment for week one where we initialize the variables for w and b (section 4.2), I’m not able to get it to run with any version of np.zeros(dim) or np.zeros(dim,1) etc. I set b = 0 directly.
I get the following:
TypeError Traceback (most recent call last)
in
1 dim = 2
----> 2 w, b = initialize_with_zeros(dim)
3
4 assert type(b) == float
5 print ("w = " + str(w))
in initialize_with_zeros(dim)
17 # b = …
18 # YOUR CODE STARTS HERE
—> 19 w = np.zeros(dim, 1)
20 b = 0
21 # YOUR CODE ENDS HERE
TypeError: data type not understood
Help would be appreciated, I can’t move on from here if the variables won’t initialize correctly and I don’t know what I’m doing wrong.
Note that the exception does not happen on the line that assigns the value to b. The syntax you are using to invoke np.zeros is not correct. Here’s the docpage for that function. Note that the first argument is a “tuple” that gives the dimensions you want for the created object.
Also note that once you fix that problem, you will also have a problem with the way you have initialized b. It needs to be a floating point value. In python 0 and 0. are not the same thing: the former is an integer.