LatentLayerBaseState#

class graph_tool.inference.LatentLayerBaseState(entropy_args={})[source]#

Bases: EntropyState

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.

get_entropy_args()

Return the current default values for the parameters of the function entropy(), together with other operations that depend on them.

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.

reset_entropy_args()

Reset the current default values for the parameters of the function entropy(), together with other operations that depend on them.

update_entropy_args(**kwargs)

Update the default values for the parameters of the function entropy() from the keyword arguments, in a stateful way, together with other operations that depend on them.

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.

get_entropy_args()#

Return the current default values for the parameters of the function entropy(), together with other operations that depend on them.

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.

reset_entropy_args()#

Reset the current default values for the parameters of the function entropy(), together with other operations that depend on them.

update_entropy_args(**kwargs)#

Update the default values for the parameters of the function entropy() from the keyword arguments, in a stateful way, together with other operations that depend on them.

Values updated in this manner are preserved by the copying or pickling of the state.