Let's say in NumPy that we have
y = np.array([1,2,2,2,1,2])
classes=np.array([1,2])
We want to do y==classes[0]
and y==classes[1]
and put these together into a single array
[[ True, False, False, False, True, False],
[False, True, True, True, False, True]]
Is there a vectorized way to construct this?