Hello,
I am at the step of defining b, and after I got this error I added the data type for b: dtype=np.float64, however I keep getting this Assertion error:

In python 0. is not the same thing as 0 is The first is a float and the second is an integer. Thatās the simple way to solve this and will give you the correct type. np.float64 is not the same as float.

Thank you Paul, I changed it to: b = np.zeros((1,1), dtype=np.float), however still returns the same error:
AssertionError Traceback (most recent call last)
in
2 w, b = initialize_with_zeros(dim)
3
----> 4 assert type(b) == float
5 print ("w = " + str(w))
6 print ("b = " + str(b))

@anastasiya27 so I tried to poke around a little to see what it is you are looking at.

And Paul is very correct, and it is not just with zeros, or x = 1 (!=) x = 1. and this can lead to sometimes confusing problems (the first produces an int the second a float).

But, in your caseā¦ Honestly Iām not sure using the numpy float type is neccessary-- you should be able to just say āfloatā.

But I think your bigger issue here, which I will leave you to think about, is b a scalar (aka āone numberā)-- Or a vector ?

I didnāt do a great job at explaining this to them Paul, but the point is their rendition of b does not include the fact that b has a dimensionality component to it. It is not (1, 1).

I continue working on the same assignment, at the step of propagate function , I received this error, not sure what it refers to as āoutā, it doesnāt really gives much information, so I am stuck, tried googling but couldnāt find the solution.

44 # YOUR CODE STARTS HERE
45 db = (I deleted my code here)
ā> 46 dw = (I deleted my code here)
47
48 # YOUR CODE ENDS HERE

<array_function internals> in dot(*args, **kwargs)

I just took a look at the documentation for numpy dot again to refresh my memory. There should be no need to use the āout=ā keyword argument when you invoke np.dot for any purpose here in this exercise. Prof Ng gave us examples of how to use np.dot in the lectures. You just write something like:

I had never seen the error message you show, so I did some experimentation. The point of the out keyword in np.dot is that there may be circumstances in which you can get better performance if you preallocated the output array to hold the result. E.g. if you were doing a loop and the target is large and it works logically to reuse it.

But if you are doing that, then out must be preallocated as the exact type and (if it is an array) the correct shape of the output of the dot product. I can get the error message you show by setting out = junk where junk is a precreated variable that is a scalar, as in:

junk = 42.

Then I get exactly the error you show. As I mentioned in my previous reply, there is no need to use out here, but if you do, it needs to be a variable that is preallocated as an array of the correct shape.

Thank you Paul, what you were saying that my out could be of a wrong shape guided me in the right direction. I checked my code again, I wasnāt using out keyword, it turns out my dw formula had parentheses in wrong places and the product was not an array, and I fixed it

Interesting. Yes, I was puzzled about where the āoutā came from in the error message. Sorry that my analysis missed the mark, but Iām very glad to hear that you were able to find the solution anyway.