Description length of consensus partition

Dear Tiago, all,

I'm happy to have discovered the new partition overlap functionality. It works very nicely. But is it possible to obtain the description length of a nested consensus state?

Getting the description length of the consensus state works fine for an unnested model:

from graph_tool.all import *
h = collection.data['polbooks']
num_models = 2
states = [minimize_blockmodel_dl(h) for i in range(num_models)]
bs = [states[i].get_blocks().a for i in range(num_models)]
c, r = partition_overlap_center(bs)

h_blocks = h.new_vp('int')
h_blocks.a = c
BlockState(h, h_blocks).entropy()

For nested partitions, getting the consensus state is a bit more complicated:

states_nested = [minimize_nested_blockmodel_dl(h) for i in range(num_models)]
bs_nested = []
for j in range(num_models):
    l = []
    for k in range(len(states_nested[j].get_levels())):
        l.append(states_nested[j].get_bstack()[k].vp.b.a)
    bs_nested.append(l)
c_nested, r_nested = nested_partition_overlap_center(bs_nested)

But how can I get its description length?

Many thanks for your attention

Haiko
GESIS, Cologne

attachment.html (3.71 KB)

Ni! Hi Haiko,

Do you mean the nested description length as in:

NestedBlockState(h, c_nested).entropy()

?

.~´

attachment.html (3.49 KB)

Do you mean the nested description length as in:

NestedBlockState(h, c_nested).entropy()

Oh man, of course, NestedBlockState() is what I was looking for!

Thx, H

attachment.html (1.81 KB)