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
Ni! Hi Haiko, Do you mean the nested description length as in: NestedBlockState(h, c_nested).entropy() ? .~´ On Fri, Apr 9, 2021 at 4:41 PM Lietz, Haiko <Haiko.Lietz@gesis.org> wrote:
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
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
participants (2)
-
Alexandre Hannud Abdo -
Lietz, Haiko