pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

Defining a model with more than one variable for Gibbs sampling #161

Closed piyushpandita92 closed 7 years ago

piyushpandita92 commented 7 years ago

Greetings all!

I am trying to do Gibbs sampling on a model with 6 parameters/variables to tune. I have a conditional posterior that i can code as follows:

  1. define a module model.py
  2. Inside model.py define @pm.stochastic def model_log_posterior(value=np.ones): # i pass an array/vector of my variables at a stage post = comp_post(value) # say comp_post is another function which takes place amicably return post

Once i run the sampler on this, it works fine and i can see the trace using:

sampler.trace(‘model_log_posterior’)[:] i do see a trace of ‘num_samp’ for 6 variables.

My question is: does pymc recognize that there are 6 different variables to tune. i know that gibbs step method needs to be defined by me by subclassing the Gibbs in pymc. But for the moment all i want to know is if pymc is doing the right thing here?

i am trying to read the code to trace where everything happens but have been unable to do so properly thus far. any help would be much appreciated.

Thank you for your attention.

fonnesbeck commented 7 years ago

Sorry for missing this. You may want to work in PyMC3 instead of PyMC2, as that is where the active development is occurring.