On Nov 27, 5:05 am, Anand Patil <
anand.prabhakar.pa...@gmail.com>
wrote:
> It's a namespace thing, try
>
> @stochastic(dtype=int)
> def s(value=1900, t_l=1851, t_h=1962):
> """The switchpoint for the rate of disaster occurrence."""
> def logp(value, t_l, t_h):
> if value > t_h or value < t_l:
> return -Inf
> else:
> return -log(t_h - t_l + 1)
> def random(t_l, t_h):
> return round( (t_l - t_h) * numpy.random.random() ) + t_l
That did the trick, thank you.
Unfortunately I still have a (minor) issue. If I try to initialize a
custom stochastic without a value, I get one of two new error
messages, depending on whether I use the constructor or the
decorator. The decorator gives me the error: "ValueError: Stochastic
s's value initialized to None; no initial value or random method
provided." while the constructor gives me the error:
"ZeroProbability: Stochastic s's value is outside its support, or it
forbids its parents' current values." I'd assumed that it was related
to my previous issue, but it seems to have persisted.
This isn't a huge deal, since I can set it to some arbitrary value and
let it wash out in the burn-in, but it seems to not be performing as
the documentation suggests it might (although the problem, as before,
may well exist somewhere between the keyboard and the chair).
> Absolutely! There's a wiki page,
http://code.google.com/p/pymc/wiki/TutorialsAndRecipes, which hasn't
> _exactly_ taken off yet... but your example would be a step in the
> right direction!
I'd be delighted to contribute it, but it doesn't seem like I can do
anything to the page you've linked but post a comment to it, and the
code is somewhat long for a single comment. I'm not familiar with
Google code, is there some trick I'm missing?
Thanks again;
Rich