I'm trying to replicate the example given in documentations for PyMC 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)
when trying to assign this:
test = switchpoint()
I get the error message(complete error message at the end of this post):
TypeError: 'numpy.ndarray' object is not callable
I'm guessing it's a compatibility problem; I'm using Enthought Canopy Python 2.7.6 (64-bit) distribution. Numpy version 1.8.0 and Scipy 0.13.3.
Can anyone help me find what the problem is?
Note: I found a small relatively old thread on google group with apparently the same problem. However the thread has no update on the status of the problem.
Here is the complete error message:
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