(This question was originally published in statistics. A. I moved it here because it relates to pymc
and the more general questions within it: in fact, the main goal is to better understand how pymc
works pymc
If any of the moderators think that it is not suitable for SO, I will clean it here.)
I read the pymc tutorial and many other questions both here and in SO.
I am trying to understand how to apply Bayes' theorem to calculate posterior probability using certain data. In particular, I have a set of independent parameters $)
=%5Cprod_ip(%5Ctheta_1).)
From the data, I would like to conclude about the probability
where
is a specific event. Then the goal is to calculate
=%5Cfrac%7Bp(E%5Cmid%5Ctheta)p(%5Ctheta)%7D%7Bp(E)%7D.)
Additional comments :
- This is a kind of unsupervised learning, I know what happened
and I want to know the parameters
that maximize the likelihood
. (*) - I would also like to have a parallel procedure when I let
pymc
calculate the probability of receiving data, and then for each set of parameters . I want to get a back chance.
In the future, I will consider that
and that probability is a multidimensional normal distribution with
(due to independence).
Below is the code I'm using (for simplicity, suppose there are only two parameters). The code is still under development (I know that it cannot work!). But I find it useful to include it, and then clarify it after comments and answers in order to provide the skeleton for future reference.
class ObsData(object): def __init__(self, params): self.theta1 = params[0] self.theta2 = params[1] class Model(object): def __init__(self, data):
The following questions arise:
- Does
self.likelihood
Bayesian probability? - How to use the data? (I suspect
value=data
incorrect ..) - Does
.sample()
really calculate the back probability? - How do I get information from the back?
- (*) Should I include everything related to the fact that
happened at some point? - As a general question : is it possible to use
pymc
only to calculate the probability of receiving data and priorities?
Any comments, as well as a link to another question or tutorial are welcome!
source share