Please help me find the mistake
I don't know precisely what's happening under the hood, but your list comprehensions on lines 31-33 are wrong and causing numpy to produce some funky arrays.

If you pull each of them out of the np.array calls and attempt to run them, you'll generate a nice SyntaxError (which is nice because it'll loudly tell us what's wrong!).
Right now, the error is getting suppressed by the fact Python is taking that funky list comprehension and creating a generator expression (I'm guessing due to how Python manages argument packing).

I'm unsure of the intent of lines 31 and 32 (are they supposed to be individual records from the data?), but line 33 can be rewritten as:

rand_y = np.array([binary_target[y_i] for y_i in rand_index])