[英]Reshape a matrix from (100, ) to (100, 405416)
I am trying to reshape a one-hot encoded array to (samples, 405416)
.我正在尝试将单热编码数组重塑为
(samples, 405416)
。 The output shape after one-hot encoded is (405416, 405416)
and I want it to reshape to (100, 405416)
where 100
is the samples. one-hot 编码后的输出形状是
(405416, 405416)
,我希望它重塑为(100, 405416)
,其中100
是样本。
y = []
for i in range(100):
random_num = randint(0, 405416, 1)
y.append(data_enc[random_number])
The output y
shape is (100, )
输出
y
形状为(100, )
The output y[0]
shape is (1, 405416)
输出
y[0]
形状为(1, 405416)
data_enc
is the matrix of shape (405416, 405416)
after one-hot encoding data_enc
是one-hot编码后的shape矩阵(405416, 405416)
Reshape of a matrix should contain same number of elements from input to reshaped matrix.矩阵的重塑应该包含从输入到重塑矩阵的相同数量的元素。 so reshaping (405416, 405416) to (100, 405416) is not possible.
所以将 (405416, 405416) 重塑为 (100, 405416) 是不可能的。
When you have 100 samples then the onehot encoding should result (100, features) not (features, features).当您有 100 个样本时,onehot 编码的结果应该是 (100, features) 而不是 (features, features)。 Check your implementation of Onehot clearly.
清楚地检查您对 Onehot 的实施。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.