我一直在尝试按照PYMC3上的教程https://pymc-devs.github.io/pymc3/getting_started/,但是当我看到以下代码部分时,我遇到了错误......
from pymc3 import Exponential, T, logtransform, exp, Deterministic
from pymc3.distributions.timeseries import GaussianRandomWalk
with Model() as sp500_model:
nu = Exponential('nu', 1./10, testval=.1)
sigma, log_sigma = sp500_model.TransformedVar('sigma', Exponential.dist(1./.02, testval=.1),
logtransform)
s = GaussianRandomWalk('s', sigma**-2, shape=n)
volatility_process = Deterministic('volatility_process', exp(-2*s))
r = T('r', nu, lam=volatility_process, observed=returns)
Run Code Online (Sandbox Code Playgroud)
第一个错误是"无法导入名称logtransform".第二个错误(如果我不尝试加载logtransform)是"'模型'对象没有属性TransformedVar".
我在Windows 7上的IPython Notebook中运行它,我尝试卸载并重新安装PyMC3无济于事.