LatentLayerBaseState#
- class graph_tool.inference.LatentLayerBaseState(entropy_args={})[source]#
Bases:
EntropyStateBase state for uncertain latent layer network inference.
Methods
collect_marginal([gs, total])Collect marginal inferred network during MCMC runs.
Collect marginal latent multigraphs during MCMC runs.
copy(**kwargs)Copies the state.
get_ec([ew])Return edge property map with layer membership.
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()withmultiflip=True.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:
- gslist of
Graph(optional, default:None) Previous marginal graphs.
- total
bool(optional, default:False) If
True, an additional marginal graph is collected for the state’s full graph (self.g), and appended to the end of the list.
- gslist of
- Returns:
- glist of
Graph New list of marginal graphs, each with internal edge
EdgePropertyMap"eprob", containing the marginal probabilities for each edge.
- glist of
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:
- gslist of
Graph(optional, default:None) Previous marginal multigraphs.
- gslist of
- Returns:
- glist of
Graph New marginal multigraphs, each with internal edge
EdgePropertyMap"w"and"wcount", containing the edge multiplicities and their respective counts.
- glist of
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.
- copy(**kwargs)#
Copies the state. The parameters override the state properties, and have the same meaning as in the constructor.
- 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
rcontrols the probability with which edge moves will be attempted, instead of partition moves. The remaining keyword parameters will be passed tomcmc_sweep()ormultiflip_mcmc_sweep(), ifmultiflip=True.
- multiflip_mcmc_sweep(**kwargs)[source]#
Alias for
mcmc_sweep()withmultiflip=True.