Hi all, I have a NestedBlockState with LayeredBlockState as basis, two layers. I would like to predict edges that are missing in one or the other layer (besides, is this even possible?). However, given a list of missing edges (and a list of spurious ones) I tried this
a_state.get_edges_prob(missing, spurious)
and get this error
AttributeError Traceback (most recent call last) <ipython-input-68-b3bc5280d3da> in <module> ----> 1 a_state.get_edges_prob([missing], spurious)
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/nested_blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args) 441 lstate._state.clear_egroups() 442 --> 443 L += lstate.get_edges_prob(missing, spurious, entropy_args=eargs) 444 if isinstance(self.levels[0], LayeredBlockState): 445 missing = [(lstate.b[u], lstate.b[v], l_) for u, v, l_ in missing]
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args) 1204 pos[v] = self.b[v] 1205 -> 1206 self.remove_vertex(pos.keys()) 1207 1208 try:
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/blockmodel.py in remove_vertex(self, v) 1144 twice. 1145 """ -> 1146 self._state.remove_vertex(int(v)) 1147 1148 def add_vertex(self, v, r):
AttributeError: 'graph_tool::BlockState<boost::undirected_adaptor<b' object has no attribute 'remove_vertex'
I'm not sure what's happening here, but as far as I know gt.BlockState (and gt.NestedBlockState and gt.LayeredBlockState) have a remove_vertex method defined, right?
Hi,
Please open an issue in the website, including a minimal working example that shows the problem, the graph-tool version used, and all the other requested information...
Best, Tiago
Am 28.08.21 um 13:26 schrieb Davide Cittaro:
Hi all, I have a NestedBlockState with LayeredBlockState as basis, two layers. I would like to predict edges that are missing in one or the other layer (besides, is this even possible?). However, given a list of missing edges (and a list of spurious ones) I tried this
a_state.get_edges_prob(missing, spurious)
and get this error
AttributeError Traceback (most recent call last) <ipython-input-68-b3bc5280d3da> in <module> ----> 1 a_state.get_edges_prob([missing], spurious)
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/nested_blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args) 441 lstate._state.clear_egroups() 442 --> 443 L += lstate.get_edges_prob(missing, spurious, entropy_args=eargs) 444 if isinstance(self.levels[0], LayeredBlockState): 445 missing = [(lstate.b[u], lstate.b[v], l_) for u, v, l_ in missing]
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args) 1204 pos[v] = self.b[v] 1205 -> 1206 self.remove_vertex(pos.keys()) 1207 1208 try:
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/blockmodel.py in remove_vertex(self, v) 1144 twice. 1145 """ -> 1146 self._state.remove_vertex(int(v)) 1147 1148 def add_vertex(self, v, r):
AttributeError: 'graph_tool::BlockState<boost::undirected_adaptor<b' object has no attribute 'remove_vertex'
I'm not sure what's happening here, but as far as I know gt.BlockState (and gt.NestedBlockState and gt.LayeredBlockState) have a remove_vertex method defined, right? _______________________________________________ graph-tool mailing list -- graph-tool@skewed.de To unsubscribe send an email to graph-tool-leave@skewed.de
Uhm... I will, in the meantime I realized that I was not specifying the missing edges properly. In fact, testing a working example on gt 2.40 made me realize I have to pass the layer as well for missing edges (source, target, layer), is this correct? Now, on another installation with gt 2.43 that doesn't work anymore. I will open an issue for gt 2.43 only, but as a general question: is it possible to have the probability of a missing edge for a specific layer when LayeredBlockState is used?
Am 01.09.21 um 10:34 schrieb Davide Cittaro:
Uhm... I will, in the meantime I realized that I was not specifying the missing edges properly. In fact, testing a working example on gt 2.40 made me realize I have to pass the layer as well for missing edges (source, target, layer), is this correct? Now, on another installation with gt 2.43 that doesn't work anymore. I will open an issue for gt 2.43 only, but as a general question: is it possible to have the probability of a missing edge for a specific layer when LayeredBlockState is used?
Not only it's possible, but it is the only way possible.
Sorry for the continuous cross-posting. Now referencing https://git.skewed.de/count0/graph-tool/-/issues/713 I understand what you mean by "the only way possible". I cannot predict edges in a layer if a node has zero connectivity in that layer.