Building shapes from saved tracks in pymc

I need to run MCMC at different times with different parameters in order to check convergence. So I decided to keep the tracks so that when I need to know (for compilation purposes) what was the result

pymc.MCMC (iter = 10000, burn = 1000, thin = 10)

I do not need to repeat it. (It takes a lot of time (I have to do the same for many different parameter values)).

I found a solution

m = MCMC([tau, rv], db='pickle', dbname='10000iter1000burn.pickle')
m.sample(iter = 10000, burn = 5000, thin = 10)
m.db.close()

So, the trace is now saved in a database named 10000iter1000burn.pickle

Now, to load the trace, I do the following

db = pymc.database.pickle.load('10000iter5000burn.pickle')

and when I execute print db.trace('tau')[:], I get the same output, but when I want tp to draw a figure or get other information, it fails

plot(db)  #error

plot() 2 (1 ) (m) ( , ), .

db.tau.summary() "" "summary" , m.tau.summary()

db.logp

. , , - . - , - mcmc , .

+4
1

. (1) node/ (2) (3) pymc-/ (4) .

+4

Source: https://habr.com/ru/post/1542394/


All Articles