草庐IT

python - numpy `ValueError: operands could not be broadcast together with shape ...`

我正在使用python2.7并尝试预测从1.00000000到3.0000000008的一些随机数据。我的数组中有大约196个项目,我得到了错误ValueError:operandscouldnotbebroadcasttogetherwithshape(2)(50)我自己似乎无法解决这个问题。任何帮助或相关文档的链接将不胜感激。这是我正在使用的生成此错误的代码nsample=50sig=0.25x1=np.linspace(0,20,nsample)X=np.c_[x1,np.sin(x1),(x1-5)**2,np.ones(nsample)]beta=masterAverageL

python - numpy `ValueError: operands could not be broadcast together with shape ...`

我正在使用python2.7并尝试预测从1.00000000到3.0000000008的一些随机数据。我的数组中有大约196个项目,我得到了错误ValueError:operandscouldnotbebroadcasttogetherwithshape(2)(50)我自己似乎无法解决这个问题。任何帮助或相关文档的链接将不胜感激。这是我正在使用的生成此错误的代码nsample=50sig=0.25x1=np.linspace(0,20,nsample)X=np.c_[x1,np.sin(x1),(x1-5)**2,np.ones(nsample)]beta=masterAverageL