graph_tool.inference.LatentLayerBaseState#

class graph_tool.inference.LatentLayerBaseState[source]#

Bases: object

Base state for uncertain latent layer network inference.

Methods

collect_marginal([gs, total])

Collect marginal inferred network during MCMC runs.

collect_marginal_multigraph([gs])

Collect marginal latent multigraphs during MCMC runs.

get_ec([ew])

Return edge property map with layer membership.

mcmc_sweep([r, multiflip])

Perform sweeps of a Metropolis-Hastings acceptance-rejection sampling MCMC to sample network partitions and latent edges.

multiflip_mcmc_sweep(**kwargs)

Alias for mcmc_sweep() with multiflip=True.

collect_marginal(gs=None, total=False)[source]#

Collect marginal inferred network during MCMC runs.

Parameters:
glist of Graph (optional, default: None)

Previous marginal graphs.

Returns:
glist Graph

New list of marginal graphs, each with internal edge EdgePropertyMap "eprob", containing the marginal probabilities for each edge.

Notes

The posterior marginal probability of an edge \((i,j)\) is defined as

\[\pi_{ij} = \sum_{\boldsymbol A}A_{ij}P(\boldsymbol A|\boldsymbol D)\]

where \(P(\boldsymbol A|\boldsymbol D)\) is the posterior probability given the data.

This function returns a list with the marginal graphs for every layer.

collect_marginal_multigraph(gs=None)[source]#

Collect marginal latent multigraphs during MCMC runs.

Parameters:
glist of Graph (optional, default: None)

Previous marginal multigraphs.

Returns:
glist of Graph

New marginal multigraphs, each with internal edge EdgePropertyMap "w" and "wcount", containing the edge multiplicities and their respective counts.

Notes

The mean posterior marginal multiplicity distribution of a multi-edge \((i,j)\) is defined as

\[\pi_{ij}(w) = \sum_{\boldsymbol G}\delta_{w,G_{ij}}P(\boldsymbol G|\boldsymbol D)\]

where \(P(\boldsymbol G|\boldsymbol D)\) is the posterior probability of a multigraph \(\boldsymbol G\) given the data.

This function returns a list with the marginal graphs for every layer.

get_ec(ew=None)[source]#

Return edge property map with layer membership.

mcmc_sweep(r=0.5, multiflip=True, **kwargs)[source]#

Perform sweeps of a Metropolis-Hastings acceptance-rejection sampling MCMC to sample network partitions and latent edges. The parameter r controls the probability with which edge move will be attempted, instead of partition moves. The remaining keyword parameters will be passed to mcmc_sweep() or multiflip_mcmc_sweep(), if multiflip=True.

multiflip_mcmc_sweep(**kwargs)[source]#

Alias for mcmc_sweep() with multiflip=True.