내가 PyMC 2.3 documentations에 주어진 예를 복제하기 위해 노력하고있어 :생성 확률 장식 2.3
@pm2.stochastic(dtype=int)
def switchpoint(value=1900, t_l=1851, t_h=1962):
"""The switchpoint for the rate of disaster occurrence."""
if value > t_h or value < t_l:
# Invalid values
return -np.inf
else:
# Uniform log-likelihood
return -np.log(t_h - t_l + 1)
이 할당하려고 : 나는 오류 메시지가
test = switchpoint()
을 (이 게시물 끝에있는 완전한 오류 메시지) :
TypeError: 'numpy.ndarray' object is not callable
나는 호환성 문제가 있다고 생각합니다. Enthought Canopy Python 2.7.6 (64-bit) 배포판을 사용하고 있습니다. Numpy 버전 1.8.0 및 Scipy 0.13.3.
문제가 무엇인지 쉽게 알 수 있습니까?
참고 : 분명히 같은 문제가있는 비교적 작은 old thread을 Google 그룹에서 발견했습니다. 그러나 스레드는 문제의 상태에 대한 업데이트가 없습니다.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/CommonDeterministics.py", line 975, in __call__
plot=False)
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/PyMCObjects.py", line 435, in __init__
verbose=verbose)
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/Node.py", line 216, in __init__
Node.__init__(self, doc, name, parents, cache_depth, verbose=verbose)
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/Node.py", line 127, in __init__
self.parents = parents
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/Node.py", line 150, in _set_parents
self.gen_lazy_function()
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/PyMCObjects.py", line 446, in gen_lazy_function
self._value.force_compute()
File "LazyFunction.pyx", line 257, in pymc.LazyFunction.LazyFunction.force_compute (pymc/LazyFunction.c:2409)
File "/Users/arash/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/CommonDeterministics.py", line 967, in eval_fun
return self(*args, **kwargs)
TypeError: 'numpy.ndarray' object is not callable
감사를이처럼 당신이 확률 변수를 정의 할 수있는 다른 방법 보면 그것은 더 의미가 있습니다! 나는 그런 개념을 이해하지 못했다. 귀하의 답변은 문제를 해결하고 정말로 도움이되었습니다. – Bersavosh