[graph-tool] Questions about inference algorithms

Tiago de Paula Peixoto tiago at skewed.de
Thu May 12 16:31:28 CEST 2016

On 12.05.2016 10:56, Andrea Briega wrote:
> vprop_double = g.new_vertex_property("int") # g is my network
>  for i in range(0, 11772):
>      vprop_double[g.vertex(i)] = 1
>  for i in range(11773, 214221):
>      vprop_double[g.vertex(i)] = 2
> state = gt.minimize_blockmodel_dl(g, pclabel=True)

You should not pass "pclabel=True" here... the pclabel parameter expects
the property map itself, not a Boolean value. Furthermore, you should
not pass it the minimize_blockmodel_dl() function directly. Instead, you
should do

   state = gt.minimize_blockmodel_dl(g, state_args=dict(pclabel=vprop_double))

> state.entropy(dl=True) # I am not sure this is the right way to get the description length.

It is, but if you look at the documentation, you will see that the
default is "dl = True", hence calling only state.entropy() is

> But now I have some problems. First of all, minimize_blockmodel_dl
> doesn't have a pclabel argument so I don't know how indicate it in the
> inference algorithm. I have tried this:
> state.pclabel = vprop_double

This is incorrect. Never try to modify the states directly like
this. You have to do it like I described above.

> And finally, in NestedBlockState objects I don't know to get
> description length because entropy hasn't a "dl" argument. In these
> objects entropy and dl are the same?

Yes. Since the NestedBlockState corresponds to the regular BlockState
plus an hierarchical prior, its full entropy corresponds always to the
description length.


Tiago de Paula Peixoto <tiago at skewed.de>

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

More information about the graph-tool mailing list