Hello, I am trying to add a more detailed level at the bottom of a nested blockmodel. Given a graph g, I run c = gt.is_bipartite(g, True)[1] state = gt.minimize_nested_blockmodel_dl(g, deg_corr=True, layers=True, state_args=dict(ec=g.ep.visits, layers=False, pclabel=c), verbose=True) to find a nestedBlockState 'state'. Then I run state.duplicate_level(0) bstate = state.find_new_level(0, bisection_args={'verbose': True}) This seems to correctly invoke the bisection_minimize() method and runs for a while, then raises a ValueError: provided clabel is inconsistent with node partition. The output is below. Where exactly is the inconsistency coming from? Thank you, Peter B: 90666 <- 165691 shrinking 165691 -> 90666 B: 90666 <- 165691 B=90666 niter: 1 count: 0 breaks: 0 min_S: 4549865.6 max_S: 4549925.5 S: 4549865.6 ΔS: -59.8492 moves: 768 B: 90666 <- 165691 B=90666 niter: 2 count: 0 breaks: 0 min_S: 4549799.7 max_S: 4549925.5 S: 4549799.7 ΔS: -65.8762 moves: 720 B: 90666 <- 165691 B=90666 niter: 3 count: 0 breaks: 0 min_S: 4549799.5 max_S: 4549925.5 S: 4549799.5 ΔS: -0.251813 moves: 759 B: 90666 <- 165691 B=90666 niter: 4 count: 0 breaks: 0 min_S: 4549671.3 max_S: 4549925.5 S: 4549671.3 ΔS: -128.157 moves: 788 B: 90666 <- 165691 B=90666 niter: 5 count: 0 breaks: 0 min_S: 4549577.9 max_S: 4549925.5 S: 4549577.9 ΔS: -93.3804 moves: 797 B: 90666 <- 165691 B=90666 niter: 6 count: 0 breaks: 0 min_S: 4549495.5 max_S: 4549925.5 S: 4549495.5 ΔS: -82.3979 moves: 787 B: 90666 <- 165691 B=90666 niter: 7 count: 0 breaks: 0 min_S: 4549459.7 max_S: 4549925.5 S: 4549459.7 ΔS: -35.8572 moves: 777 ... ... ... Current bracket: (851, 90666, 165691) (2756226.276337453, 4857281.779995878, 4882260.334948147) B: 44298 <- 90666 shrinking 90666 -> 45333 Traceback (most recent call last): File "code/add_layer.py", line 9, in <module> bstate = state.find_new_level(0, bisection_args={'verbose': True}) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/nested_blockmodel.py", line 447, in find_new_level state = bisection_minimize([min_state, max_state], **bisection_args) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/bisection.py", line 157, in bisection_minimize f_mid = get_state_dl(B=mid_B, **kwargs) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/bisection.py", line 85, in get_state_dl (B, B_prev))))) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/mcmc.py", line 358, in mcmc_multilevel state = state.shrink(B=B_next, **shrink_args) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/layered_blockmodel.py", line 862, in shrink return BlockState.shrink(self, B, **kwargs) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/blockmodel.py", line 1580, in shrink state = self.copy(b=b) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/layered_blockmodel.py", line 434, in copy "rec_params", "allow_empty"])) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/layered_blockmodel.py", line 149, in __init__ "layer_entropy"])) File "/usr/lib/python2.7/dist-packages/graph_tool/inference/blockmodel.py", line 310, in __init__ raise ValueError("provided clabel is inconsistent with node partition") ValueError: provided clabel is inconsistent with node partition Dr Peter Straka Research Fellow (DECRA) School of Physical Engineering and Mathematical Sciences | UNSW Canberra Google Scholar <https://scholar.google.com.au/citations?user=o80TaWgAAAAJ> E: p.straka@unsw.edu.au skype: straka.ps
On 17.11.2016 07:02, Peter Straka wrote:
Hello,
I am trying to add a more detailed level at the bottom of a nested blockmodel. Given a graph g, I run
c = gt.is_bipartite(g, True)[1] state = gt.minimize_nested_blockmodel_dl(g, deg_corr=True, layers=True, state_args=dict(ec=g.ep.visits, layers=False, pclabel=c), verbose=True)
to find a nestedBlockState 'state'. Then I run
state.duplicate_level(0) bstate = state.find_new_level(0, bisection_args={'verbose': True})
This seems to correctly invoke the bisection_minimize() method and runs for a while, then raises a ValueError: provided clabel is inconsistent with node partition.
The output is below. Where exactly is the inconsistency coming from?
It is totally wrong to do it like this. You are using low-level functions from NestedBlockState which are meant to be used in a very particular way from inside the minimize_nested_blockmodel_dl(). I don't think it is a good idea to modify an inference algorithm in arbitrary ways just to force it to give a specific result. -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
Peter Straka -
Tiago de Paula Peixoto