图形工具 - 随机块模型与莱顿

Graph tool - Stochastic Block Model vs Leiden

我正在使用 2 种方法计算 4 个网络的网络社区:

  1. 'Leiden' 方法,它给了我 7 (a), 13 (b), 19 (c), 22 (d) 个社区。

  2. 'Stochastic block Model',还通过检查层次结构级别来检查节点的组成员资格,如下所示:


    state = gt.inference.minimize_nested_blockmodel_dl(g)
    state.print_summary()

    levels = state.get_levels()
    for s in levels:
        print(s)
        if s.get_N() == 1:
            break
    lstate = state.levels[0]
    b = lstate.get_blocks()
    print(b[10])

打印:

<BlockState object with 228 blocks (21 nonempty), degree-corrected, for graph <Graph object, undirected, with 228 vertices and 1370 edges, 1 internal vertex property, 1 internal edge property, at 0x7fbaff1c8d50>, at 0x7fba9fac1bd0>
<BlockState object with 21 blocks (6 nonempty), for graph <Graph object, undirected, with 228 vertices and 96 edges, at 0x7fb9a3c51910>, at 0x7fb9a2dd1a10>
<BlockState object with 6 blocks (1 nonempty), for graph <Graph object, undirected, with 21 vertices and 20 edges, at 0x7fb9a3c51590>, at 0x7fb9a3c51ed0>
<BlockState object with 1 blocks (1 nonempty), for graph <Graph object, undirected, with 6 vertices and 1 edge, at 0x7fb9a6f034d0>, at 0x7fb9a3c51790>
190
<Graph object, undirected, with 3459 vertices and 134046 edges, 1 internal vertex property, 1 internal edge property, at 0x7fbb62e22790>
l: 0, N: 3459, B: 294
l: 1, N: 294, B: 85
l: 2, N: 85, B: 34
l: 3, N: 34, B: 12
l: 4, N: 12, B: 4
l: 5, N: 4, B: 1
l: 6, N: 1, B: 1

并绘制:

这看起来比使用 Leiden 拥有更多的社区,我正在努力思考为什么以及这个 SBM 概念。

这些 SBM 图表是否描绘了附加层次结构,或者这里是否还有其他事情可以证明更多社区的合理性?

模块化最大化方法(Leiden 是其中的一个实现)有两个重要的性质:

  1. 它只搜索分类社区(即内部联系多于外部联系的团体)。
  2. 这是一种统计上不一致的方法,根据情况会过拟合和欠拟合。可以在此处找到关于此事的讨论:https://skewed.de/tiago/blog/modularity-harmful

SBM的推理方法在这两个方面是不同的:

  1. 它找到具有任意混合模式的组,即与其他组的连接偏好。分类是一种特殊情况,但还有许多其他可能的模式。
  2. 它以统计原则的方式实现了这一点,避免了过度拟合和欠拟合。理论介绍见:https://arxiv.org/abs/1705.10225. For a discussion on the differences between inferential and non-inferential methods see: https://arxiv.org/abs/2112.00183

由于上述原因,一般情况下不应期望 SBM 推理和 Leiden/Louvain 会产生相似的答案。

现在,无论出于何种原因,您可能只对查找分类社区感兴趣。您也可以使用 SBM 做到这一点,但使用更受约束的参数化。您可以按照此处的说明使用 graph-tool 执行此操作:https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#assortative-community-structure