Question about figure plot

Robert rxjwg98 at gmail.com
Mon Dec 14 21:43:08 EST 2015


Hi,

When I run the following code, there is no figure shown in the end.


//////////
import pymc
import numpy as np

n = 5*np.ones(4,dtype=int)
x = np.array([-.86,-.3,-.05,.73])

alpha = pymc.Normal('alpha',mu=0,tau=.01)
beta = pymc.Normal('beta',mu=0,tau=.01)

@pymc.deterministic
def theta(a=alpha, b=beta):
    """theta = logit^{-1}(a+b)"""
    return pymc.invlogit(a+b*x)
    
d = pymc.Binomial('d', n=n, p=theta, value=np.array([0.,1.,3.,5.]),\
                    observed=True)
....
import pymc
import mymodel

S = pymc.MCMC(mymodel, db='pickle')
S.sample(iter=10000, burn=5000, thin=2)
pymc.Matplot.plot(S)



I find that the figures are shown after these two lines by myself:
*************
import matplotlib.pyplot as plt
plt.show()

I have searched around and have not found some explanation about it.
The plot function here is different from Matlab's. Is there better ways than
my last two lines? (I am not confident whether my last two lines is the 
only choice.

Thanks,



More information about the Python-list mailing list