import numpy as np
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])
counts = {}
print(X[y == 0])
# prints = [[0 1 0 1]
# [0 0 0 1]]
我想知道为什么要X[y==0]
打印两个数据点。它不应该只打印[0 1 0 1]
吗?
因为X[0]
?
import numpy as np
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])
counts = {}
print(X[y == 0])
# prints = [[0 1 0 1]
# [0 0 0 1]]
我想知道为什么要X[y==0]
打印两个数据点。它不应该只打印[0 1 0 1]
吗?
因为X[0]
?