bethe_entropy#
- graph_tool.inference.bethe_entropy(g, p)[source]#
Compute the Bethe entropy given the edge block membership marginals.
- Parameters:
- g
Graph
The graph.
- p
EdgePropertyMap
Edge property map with edge marginals.
- g
- Returns:
- H
float
The Bethe entropy value (in nats)
- Hmf
float
The “mean field” entropy value (in nats), as would be returned by the
mf_entropy()
function.- pv
VertexPropertyMap
(optional, default:None
) Vertex property map with vector-type values, storing the accumulated block membership counts. These are the node marginals, as would be returned by the
collect_vertex_marginals()
method.
- H
Notes
The Bethe entropy is defined as,
\[H = -\sum_{ij}A_{ij}\sum_{rs}\pi_{ij}(r,s)\ln\pi_{ij}(r,s) - \sum_i(1-k_i)\sum_r\pi_i(r)\ln\pi_i(r),\]where \(\pi_{ij}(r,s)\) is the marginal probability that vertices \(i\) and \(j\) belong to blocks \(r\) and \(s\), respectively, and \(\pi_i(r)\) is the marginal probability that vertex \(i\) belongs to block \(r\), and \(k_i\) is the degree of vertex \(i\) (or total degree for directed graphs).
References
[mezard-information-2009]Marc Mézard, Andrea Montanari, “Information, Physics, and Computation”, Oxford Univ Press, 2009. DOI: 10.1093/acprof:oso/9780198570837.001.0001 [sci-hub, @tor]