It looks like there’s a trivial spelling error in get_edges_prob() in the LayeredBlockState model. Wasn’t sure where to post this, but here’s a minimal working example I ran in a Colab notebook.
!echo "deb http://downloads.skewed.de/apt focal main" >> /etc/apt/sources.list
!apt-key adv --keyserver keyserver.ubuntu.com --recv-key 612DEFB798507F25
!apt-get update
!apt-get install python3-graph-tool python3-matplotlib python3-cairo
#python3-cairo from Ubuntu's reposity is linked with a different python version; we need to improvise
!apt purge python3-cairo
!apt install libcairo2-dev pkg-config python3-dev
!pip install --force-reinstall pycairo
!pip install zstandard
import graph_tool.all as gt
g = gt.collection.ns["new_guinea_tribes"]
## (Using a covariate block state instead of layered, in my use case.)
state = gt.minimize_nested_blockmodel_dl(g,
state_args=dict(base_type=gt.LayeredBlockState,
state_args=dict(ec=g.ep.weight, layers=False)))
[state.get_edges_prob([], [e]) for e in state.g.edges()]
Which raises the error:
/usr/lib/python3/dist-packages/graph_tool/inference/nested_blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args)
446 lstate._state.clear_egroups()
447
--> 448 L += lstate.get_edges_prob(missing, spurious, entropy_args=eargs)
449 if isinstance(self.levels[0], LayeredBlockState):
450 missing = [(lstate.b[u], lstate.b[v], l_) for u, v, l_ in missing]
/usr/lib/python3/dist-packages/graph_tool/inference/layered_blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args)
829
830 if state.is_weighted:
--> 831 staete.eweight[e] -= 1
832 if state.eweight[e] == 0:
833 state.g.remove_edge(e)
NameError: name 'staete' is not defined
See the markdown syntax here for more formatting options: Markdown Reference