我试图抽样随机变量受给定的概率密度函数(pdf)与scipy.stats.rv_连续公司名称:
class Distribution(stats.rv_continuous):
def _pdf(self,x, _a, _c):
return first_hitting_time(x, _a, _c)
其中函数第一次击中时间是
^{pr2}$然后我继续
myrv= Distribution(name='hittingtime', a=0.002,b=30.0)
data3= myrv.rvs(size=10000, _a=1.0, _c=0.0)
翻译开始抱怨-
Traceback (most recent call last):
File "<ipython-input-246-71f67047462b>", line 1, in <module>
data3= myrv.rvs(size=10000, _a=1.0, _c=0.0)
File "C:\Users\ME\AppData\Local\Continuum\Anaconda2\lib\site-packages\scipy\stats\_distn_infrastructure.py", line 856, in rvs
raise ValueError("Domain error in arguments.")
ValueError: Domain error in arguments.
似乎如果我将_c
设置为大于0.0的某个数字,它可以正常工作,但对于小于0的_c
则不行。在
我对此有点困惑。任何帮助都将不胜感激。在
来自the documentation:
从你的函数中我不清楚}代表什么,但看起来你希望它们是负的。在
_a
和{请参阅默认实现in the source of ^{}
相关问题 更多 >
编程相关推荐