0

私の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.

これを修正してください!

4

0 に答える 0