How to use pymc to parameterize a probabilistic graphical model?

How can pymc be used to parameterize a probabilistic graphical model?

Suppose I have a PGM with two nodes Xand Y. Let's say that X->Yis a schedule.

And Xtakes two values {0,1}and Yalso takes two values {0,1}.

I want to use pymc to study the distribution parameters and populate the graphical model with it to complete the conclusions.

The way I could think is as follows:

X_p = pm.Uniform("X_p", 0, 1)
X = pm.Bernoulli("X", X_p, values=X_Vals, observed=True)
Y0_p = pm.Uniform("Y0_p", 0, 1)
Y0 = pm.Bernoulli("Y0", Y0_p, values=Y0Vals, observed=True)
Y1_p = pm.Uniform("Y1_p", 0, 1)
Y1 = pm.Bernoulli("Y1", Y1_p, values=Y1Vals, observed=True)

Here Y0Valsare the values Ycorresponding to the values X= 0 AND Y1Valsare the values Ycorresponding to the values X= 1.

, MCMC Y0_p Y1_p ... , P(X) = (X_p,1-X_p), P(Y/X):

  Y  0       1
X 
0   Y0_p   1-Y0_p
1   Y1_p   1-Y1_p

:

  • ?
  • , X 100 ? X Y 10 ?
  • - , ?
  • , , ​​.
+4

All Articles