Closed rogermosher closed 8 years ago
You've implemented your likelihood incorrectly. There is no need to call the likelihood object. You should also use the @observed decorator not the @stochastic.
Thanks for your response Chris. I did not understand your answer, so I went back to an earlier attempt which wrapped ss.genextreme in a pymc stochastic class. I found an error in scipy that was preventing that approach from working and inserted a line of code. Once I got the priors right, it worked.
Sorry for the confusing answer. Glad you got it figured out.
Here is the code:
def bayesExtremeParams(data,oparams): """ bayesExtremeParams: use Bayesian techniques to estimate genExtremeParams from data :param data: an ndarray used to find the parameter estimates :param oparams: initial params :return: shape. location, and scale parameters and 95% quantiles """
Here is the relevant part of the stack dump:
File "C:\Users\roger\AnacondaExamples\OWLReader\Stochastic.py", line 99, in bayesExtremeParams obs = gev("obs", c=shape, loc=loc, scale=scale, value=data, observed=True) File "C:\Anaconda3\lib\site-packages\pymc\CommonDeterministics.py", line 991, in call plot=False) File "C:\Anaconda3\lib\site-packages\pymc\PyMCObjects.py", line 443, in init verbose=verbose) File "C:\Anaconda3\lib\site-packages\pymc\Node.py", line 214, in init Node.init(self, doc, name, parents, cache_depth, verbose=verbose) File "C:\Anaconda3\lib\site-packages\pymc\Node.py", line 129, in init self.parents = parents File "C:\Anaconda3\lib\site-packages\pymc\Node.py", line 147, in _set_parents self.gen_lazy_function() File "C:\Anaconda3\lib\site-packages\pymc\PyMCObjects.py", line 454, in gen_lazy_function self._value.force_compute() File "pymc\LazyFunction.pyx", line 257, in pymc.LazyFunction.LazyFunction.force_compute (pymc\LazyFunction.c:2642) File "C:\Anaconda3\lib\site-packages\pymc\CommonDeterministics.py", line 983, in eval_fun return self(_args, *_kwargs) TypeError: 'numpy.ndarray' object is not callable
I assume it is trying to call the data array (value=data). Not sure what is going on.