@@ -21,7 +21,8 @@ network of American football teams, which we load from the

os.chdir("demos/inference")

except FileNotFoundError:

pass

gt.seed_rng(12)

np.random.seed(42)

gt.seed_rng(42)

.. testcode:: football

...

...

@@ -94,7 +95,7 @@ which yields:

.. testoutput:: football

103

82

.. note::

...

...

@@ -148,7 +149,7 @@ illustrate its use with the neural network of the `C. elegans

.. testsetup:: celegans

gt.seed_rng(42)

gt.seed_rng(44)

.. testcode:: celegans

...

...

@@ -206,10 +207,10 @@ which shows the number of nodes and groups in all levels:

.. testoutput:: celegans

l: 0, N: 297, B: 20

l: 1, N: 20, B: 8

l: 2, N: 8, B: 3

l: 3, N: 3, B: 1

l: 0, N: 297, B: 15

l: 1, N: 15, B: 6

l: 2, N: 6, B: 2

l: 3, N: 2, B: 1

l: 4, N: 1, B: 1

The hierarchical levels themselves are represented by individual

...

...

@@ -226,11 +227,11 @@ The hierarchical levels themselves are represented by individual

.. testoutput:: celegans

<BlockState object with 297 blocks (20 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 27 blocks (8 nonempty), for graph <Graph object, directed, with 297 vertices and 203 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>

<BlockState object with 12 blocks (3 nonempty), for graph <Graph object, directed, with 27 vertices and 51 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>

<BlockState object with 3 blocks (1 nonempty), for graph <Graph object, directed, with 12 vertices and 8 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 3 vertices and 1 edge, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>

<BlockState object with 297 blocks (15 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 15 blocks (6 nonempty), for graph <Graph object, directed, with 297 vertices and 125 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>

<BlockState object with 8 blocks (2 nonempty), for graph <Graph object, directed, with 15 vertices and 32 edges, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>

<BlockState object with 2 blocks (1 nonempty), for graph <Graph object, directed, with 8 vertices and 4 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 1 edge, 2 internal vertex properties, 1 internal edge property, at 0x...>, at 0x...>

This means that we can inspect the hierarchical partition just as before:

...

...

@@ -245,9 +246,9 @@ This means that we can inspect the hierarchical partition just as before:

.. testoutput:: celegans

175

10

2

278

4

4

Refinements using merge-split MCMC

++++++++++++++++++++++++++++++++++

...

...

@@ -282,7 +283,7 @@ to the above minimization for the `C. elegans` network is the following:

.. testoutput:: celegans-mcmc

Improvement: -83.804934...

Improvement: -36.887009...

Whenever possible, this procedure should be repeated several times, and

the result with the smallest description length (obtained via the