我的python代码在Ubuntu 14.04中成功运行;但是当我在Windows平台上运行时,它会让我误入歧途。守则:
import pylab
import pymc
with open("C:/Users/Anir/Downloads/days1.txt") as f:
dataset = list(map(float, f))
a = pymc.Uniform('a', lower=0, upper=1500000, value=70, doc='Weibull alpha parameter')
b = pymc.Uniform('b', lower=0, upper=1500000, value=70, doc='Weibull beta parameter')
like = pymc.Weibull('like', alpha=a, beta=b, value=dataset, observed=True)
if __name__=='__main__':
M = pymc.MCMC([a,b,like])
M.sample(10000,5000,2)
pymc.Matplot.plot(a)
pymc.Matplot.plot(b)
M.summary()
M.write_csv("C:/Users/Anir/Downloads/parameters1.csv")
错误:
Traceback (most recent call last):
File "C:\Users\Anir\Downloads\weibullEstimationOutData - 1 (Check).py", line 11, in <module>
like = pymc.Weibull('like', alpha=a, beta=b, value=dataset, observed=True)
File "C:\Python35-32\lib\site-packages\pymc\distributions.py", line 320, in __init__
**arg_dict_out)
File "C:\Python35-32\lib\site-packages\pymc\PyMCObjects.py", line 775, in __init__
if not isinstance(self.logp, float):
File "C:\Python35-32\lib\site-packages\pymc\PyMCObjects.py", line 932, in get_logp
raise ZeroProbability(self.errmsg)
pymc.Node.ZeroProbability: Stochastic like's value is outside its support, or it forbids its parents' current values.
请帮我解决这个问题!