Predictions = (A2 > .5)

Is it python broadcasting that operates on A2 and finds all values greater than .5 and adds them to predictions?

Yes, I guess you could consider this a special case of “broadcasting”. If you compare an array to a scalar, numpy converts that to an “elementwise” operation on the array.

To see some examples, create a new cell in your notebook by doing “Insert → Cell Below” and paste in this code and watch what happens:

np.random.seed(42)
A = np.random.rand(3,4)
print("A = " + str(A))
B = (A > 0.7)
print("B = " + str(B))
C = B.astype(float)
print("C = " + str(C))
D = (A > 0.7).astype(float)
print("D = " + str(D))