【发布时间】:2015-07-05 14:45:55
【问题描述】:
我是一名新手,在 PyCharm (Comm.Ed 4.5) 下尝试使用 Python (3.4) 中的 ML/DBN。 以下定义
def make_thetas(xmin,xmax,n):
xs = np.linespace(xmin,xmax,n)
widths = (xs[1:] - xs[:-1])/2.0
thetas = xs[:-1] + widths
return thetas
抛出错误
“类 'tuple' 没有定义 'sub',因此不能在其实例上使用 '-' 运算符”
在第三行的 - 运算符上(宽度 = ....)
有关如何在 PyCharm 下运行此代码的任何想法 - 它在交互式 Python 窗口中运行良好。
谢谢。
【问题讨论】: