marginal_multigraph_lprob

marginal_multigraph_lprob#

graph_tool.inference.marginal_multigraph_lprob(g, ews, ecount, ew)[git][source]#

Compute the log-probability of edge multiplicities according to the marginal latent multigraph distribution.

Parameters:
gGraph

Marginal multigraph.

ewsEdgePropertyMap

Vector-valued edge property map containing the observed edge multiplicities.

ecountEdgePropertyMap

Vector-valued edge property map containing the counts of each multiplicity in ews. The property map "wcount" returned by collect_marginal_multigraph() is indexed by the multiplicity itself, so that it is used together with ews[e] = range(len(wcount[e])).

ewEdgePropertyMap

Edge multiplicities whose probability will be computed.

Returns:
Lfloat

Log-probability of the edge multiplicities ew.

See also

marginal_multigraph_sample

Sample from the marginal multigraph distribution

marginal_multigraph_entropy

Entropy of the marginal multigraph distribution

marginal_graph_lprob

Log-probability of a marginal graph

Notes

The log-probability is computed as

\[\ln P(\boldsymbol w) = \sum_{(i,j)}\ln \pi_{ij}(w_{ij}),\]

where the sum is over the edges of g, and

\[\pi_{ij}(w) = \frac{n_{ij}(w)}{\sum_{w'}n_{ij}(w')},\]

with \(n_{ij}(w)\) being the count of multiplicity \(w\), given by ecount. If a multiplicity in ew has not been observed for its edge, the value \(-\infty\) will be returned.

This algorithm runs in time \(O(\sum_{ij}k_{ij})\), where \(k_{ij}\) is the number of distinct multiplicities observed for edge \((i,j)\).

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.