[graph-tool] Questions about output of "history" of graph_tool.inference.mcmc_equilibrate

Tiago de Paula Peixoto tiago at skewed.de
Mon Feb 13 17:48:58 CET 2017


On 13.02.2017 15:30, P-M wrote:
> I have just run the following snippet of code:
> 
>     mcmc_args=dict(parallel = True,niter=10)
>     history = gt.mcmc_equilibrate(state, wait=1000,
> history=True,mcmc_args=mcmc_args)
>     with open('history1.pkl','wb') as his1_pkl:
>         pickle.dump(history,his1_pkl,-1)
> 
> According to the manual history is a "list of tuples of the form (iteration,
> entropy)". When unpickling it however I get a list of length 2000. Each
> element in the list is another list of length two containing `nan` as first
> entry and then a single-digit integer as second entry.
> 
> A couple of questions:
> 1) I would expect a tuple, not a list for each entry in the list. Is the
> manual wrong or is the code wrong? Or did I do something wrong?

The point of the documentation was that two values for each step are
returned, not that the actual type was a tuple. Most code should not care
about this.

> 2) Why am I receiving `nan` rather than a value for "iteration" as first
> entry of my list?

I have no idea. I can't reproduce this. You have to send a complete example
that shows the problem

> 3) Is there a particular reason why the length of the list is precisely 2000
> in this case? (Obviously there is, I just haven't quite figured it out yet.)

As stated in the documentation, this is a stochastic algorithm which will
stop after equilibration has been detected (using a record-breaking
heuristic). Hence, the length of the history will be different each time.

Best,
Tiago

-- 
Tiago de Paula Peixoto <tiago at skewed.de>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.skewed.de/pipermail/graph-tool/attachments/20170213/dfabb5aa/attachment.asc>


More information about the graph-tool mailing list