I'm reading the book Introduction Machine Learning to Python and this code is on page 69. I can't understand that why I can get a result of this.
X = np.array([[0, 1, 0, 1], [1, 0, 1, 1], [0, 0, 0, 1], [1, 0, 1, 0]]) y = np.array([0, 1, 0, 1]) for label in np.unique(y): print(X[y == label]) result:
[[0 1 0 1] [0 0 0 1]] [[1 0 1 1] [1 0 1 0]]