import numpy as np y = np.array([0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1]) num_zeros = (y == 0).sum() num_ones = (y == 1).sum()