@@ -21,7 +21,7 @@ network of American football teams, which we load from the
os.chdir("demos/inference")
except FileNotFoundError:
pass
gt.seed_rng(8)
gt.seed_rng(12)
.. testcode:: football
...
...
@@ -32,7 +32,7 @@ which yields
.. testoutput:: football
<Graph object, undirected, with 115 vertices and 613 edges at 0x...>
<Graph object, undirected, with 115 vertices and 613 edges, 4 internal vertex properties, 2 internal graph properties, at 0x...>
we then fit the degree-corrected model by calling
...
...
@@ -134,7 +134,7 @@ illustrate its use with the neural network of the `C. elegans
.. testsetup:: celegans
gt.seed_rng(51)
gt.seed_rng(52)
.. testcode:: celegans
...
...
@@ -145,7 +145,7 @@ which has 297 vertices and 2359 edges.
.. testoutput:: celegans
<Graph object, directed, with 297 vertices and 2359 edges at 0x...>
<Graph object, directed, with 297 vertices and 2359 edges, 2 internal vertex properties, 1 internal edge property, 2 internal graph properties, at 0x...>
A hierarchical fit of the degree-corrected model is performed as follows.
...
...
@@ -161,10 +161,16 @@ clustering using the
.. testcode:: celegans
state.draw(output="celegans-hsbm-fit.svg")
state.draw(output="celegans-hsbm-fit.pdf")
.. figure:: celegans-hsbm-fit.*
.. testcleanup:: celegans
conv_png("celegans-hsbm-fit.pdf")
.. figure:: celegans-hsbm-fit.png
:align: center
:width: 80%
Most likely hierarchical partition of the neural network of
the *C. elegans* worm according to the nested degree-corrected SBM.
...
...
@@ -186,10 +192,10 @@ which shows the number of nodes and groups in all levels:
.. testoutput:: celegans
l: 0, N: 297, B: 16
l: 1, N: 16, B: 8
l: 2, N: 8, B: 3
l: 3, N: 3, B: 1
l: 0, N: 297, B: 19
l: 1, N: 19, B: 6
l: 2, N: 6, B: 2
l: 3, N: 2, B: 1
The hierarchical levels themselves are represented by individual
:meth:`~graph_tool.inference.blockmodel.BlockState` instances obtained via the
...
...
@@ -203,10 +209,10 @@ The hierarchical levels themselves are represented by individual
.. testoutput:: celegans
<BlockState object with 16 blocks (16 nonempty), degree-corrected, for graph <Graph object, directed, with 297 vertices and 2359 edges at 0x...>, at 0x...>
<BlockState object with 8 blocks (8 nonempty), for graph <Graph object, directed, with 16 vertices and 134 edges at 0x...>, at 0x...>
<BlockState object with 3 blocks (3 nonempty), for graph <Graph object, directed, with 8 vertices and 50 edges at 0x...>, at 0x...>
<BlockState object with 1 blocks (1 nonempty), for graph <Graph object, directed, with 3 vertices and 8 edges at 0x...>, at 0x...>
<BlockState object with 19 blocks (19 nonempty), degree-corrected, for graph <Graph object, directed, with 297 vertices and 2359 edges, 2 internal vertex properties, 1 internal edge property, 2 internal graph properties, at 0x...>, at 0x...>
<BlockState object with 6 blocks (6 nonempty), for graph <Graph object, directed, with 19 vertices and 176 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>
<BlockState object with 2 blocks (2 nonempty), for graph <Graph object, directed, with 6 vertices and 30 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>
<BlockState object with 1 blocks (1 nonempty), for graph <Graph object, directed, with 2 vertices and 4 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>
This means that we can inspect the hierarchical partition just as before:
...
...
@@ -221,6 +227,54 @@ This means that we can inspect the hierarchical partition just as before:
.. testoutput:: celegans
5
2
1
0
Trade-off between memory usage and computation time