The*_*pus 19 python arrays numpy numpy-broadcasting
我正在使用python 2.7并尝试预测从1.00000000到3.0000000008的一些随机数据.我的阵列中有大约196个项目,我收到错误
ValueError: operands could not be broadcast together with shape (2) (50)
Run Code Online (Sandbox Code Playgroud)
我似乎无法独自解决这个问题.任何帮助或相关文档的链接将不胜感激.
这是我正在使用的代码生成此错误
nsample = 50
sig = 0.25
x1 = np.linspace(0,20, nsample)
X = np.c_[x1, np.sin(x1), (x1-5)**2, np.ones(nsample)]
beta = masterAverageList
y_true = ((X, beta))
y = y_true + sig * np.random.normal(size=nsample)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
86925 次 |
| 最近记录: |