【发布时间】:2021-12-10 01:03:48
【问题描述】:
我有一个数组 idnl,其中包含从 0 到 10000 的非连续数字
u = rng.integers(0, 100, size = N)/100.0
temp = (np.cumsum(priors))
thresholds = [temp[0], temp[1],1]
indl = (np.argwhere(u <= thresholds[l]))
Nl = np.size(indl)
数组 x 是 [10000, 2] 用零填充。
x = np.zeros((n,N)).transpose()
我想生成随机数的正态分布并将每个有序对复制到 x 中由 indl 索引的行。
matlab 代码为x(:,indl) = mvrnd(...etc..)
x[indl,:] = rng.multivariate_normal(meanVectors[l,:], covMatrices[l,:,:], Nl)
x 应该是这样的 -
[0,0
0,0
0.53, 0.98
0,0
0.46, 0.56
0.87, 0.23
.
.
.]
但我不断收到这样的错误:
ValueError: shape mismatch: value array of shape (5106,2) could not be broadcast to indexing result of shape (1,5106,10000)
我一直在这为hoooours....请帮助!
【问题讨论】:
标签: python arrays numpy matlab data-science