Hi Anatol, This is indeed a bug. Thanks for the minimal example that shows the problem.
I've fixed this, and I will push it to git soon.
Best,
Tiago
Am 17.01.20 um 05:29 schrieb Anatol Wegner:
> Hi,
>
> I am getting the following error when using get_edges_prob() with
> layered SBMs. Minimal example:
>
> import graph_tool.all as gt
> import numpy as np
> gr=gt.generate_sbm(b=np.array([0]*500+[1]*500),probs=np.array([[10000,200],[200,10000]]))
> etype=gr.new_edge_property('int')
> gr.ep.etype=etype
> for e in gr.edges():
> gr.ep.etype[e]=np.random.choice([0,1,2,3])
> state = gt.minimize_nested_blockmodel_dl(gr,
> deg_corr=True,layers=True,state_args=dict(ec=gr.ep.etype,layers=True),verbose=False)
>
> state.get_edges_prob([[2,32,0],[3,4,2]],spurious=[])
>
> ---------------------------------------------------------------------------
> UnboundLocalError Traceback (most recent call last)
> <ipython-input-30-a1758ce2345d> in <module>()
> 7 gr.ep.etype[e]=np.random.choice([0,1,2,3])
> 8 state = gt.inference.minimize_nested_blockmodel_dl(gr,
> deg_corr=True,layers=True,state_args=dict(ec=gr.ep.etype,layers=True),verbose=False)
> ----> 9state.get_edges_prob([[2,32,0],[3,4,2]],spurious=[])
>
> /usr/lib/python2.7/dist-packages/graph_tool/inference/nested_blockmodel.py in
> get_edges_prob(self, missing, spurious, entropy_args)
> 481 lstate._state.clear_egroups()
> 482
> --> 483L += lstate.get_edges_prob(missing, spurious, entropy_args=eargs)
> 484 if isinstance(self.levels[0], LayeredBlockState):
> 485 missing = [(lstate.b[u], lstate.b[v], l_) for u, v, l_ in
> missing]
>
> /usr/lib/python2.7/dist-packages/graph_tool/inference/layered_blockmodel.py
> in get_edges_prob(self, missing, spurious, entropy_args)
> 934 state = self.layer_states[l[0]]
> 935 state.g.remove_edge(e)
> --> 936for u, v, l in old_es:
> 937 if not l[1]:
> 938 state = self.agg_state
>
> UnboundLocalError: local variable 'old_es' referenced before assignment
>
>
> Regards,
> Anatol
>
>
> _______________________________________________
> graph-tool mailing list
> [email protected]
> https://lists.skewed.de/mailman/listinfo/graph-tool
>
--
Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] https://lists.skewed.de/mailman/listinfo/graph-tool
