-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Working with sampled pymc3 parameter values #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like you are trying to cast a PyMC object to a float, which will not work. Are you trying to come up with some sort of mixture of the two stochastics? If so, you should be looking at using a Deterministic object instead. |
Thank you for your fast answer!
This code works fine. And i can get float values from x and y. How do I translate this code into pymc3?
But this gives me an error:
So my main point is, how to translate the pymc2.3 example into a working pymc3 style where I can analyse my complex model with floats of the stochastics x and y and many more stochastics? |
Isn´t there any possibility to access the values of the sampled stochastics? |
You aren't using
The Then, it the return value should be passed to the deterministic, not the function itself:
Not surprised that you are confused, as we have not written up the documentation yet (but we are working towards it). |
Thanks to @fonnesbeck! Now i´ve understand what this What i search for is an algorithm which fits my external complexmodel with some parameters (here they are called stochastics) to observed data. PyMC2.3 does this job very good and I have the feeling that PyMC3 could do it even better. But I don´t know how to do it. To show what i exactly want, I made my example from above more explicite:
I would expect that my |
Check out the approach used in #507, which allows you to make arbitrary deterministics compatible with PyMC 3's Theano internals. In particular, see the |
Thanks for this great hint! My code is working now:
Do you plan, to bring gradient based samplers to work with this, or maybe a more straightforward, trick? When I use for example your NUTS sampler as a step method I get an error:
|
The only way to get the automatic gradient computation is by expressing your density in terms of theano operators. |
I've started to work with pymc2.3 to calibrate some complex extern models (with the @pm.deterministic decorator) and I can say that pymc is awesome. But as i've really a lot of parameters to calibrate i wanted to test the new NUTS sampler of pymc3. Here I'm struggeling how to work with the sampled parameter values. I think the sampler of pymc2 creates floats, which is exactly what i need for my complex model. pymc3 seems to create some 'pymc3.model.FreeRV' theano.tensor things during the sampling and I do not know how to work with them. Is it somehow possible to transform the sampled values into floats?
Some example code, where i want to have float paramters x and y to feed my complex model with:
This gives me the following error:
Thanks for some hints!
PS.: I would also be very happy about an implementation of the DREAM sampler in pymc3 (#585).
I could not bring the multichain_mcmc package to work with pymc2.3.
The text was updated successfully, but these errors were encountered: