graph_tool.inference.PseudoCIsingBlockState#

class graph_tool.inference.PseudoCIsingBlockState(*args, **kwargs)[source]#

Bases: IsingBaseBlockState

State for network reconstruction based on the equilibrium configurations of the continuous Ising model, using the Pseudolikelihood approximation and the stochastic block model as a prior.

See documentation for IsingBaseBlockState for details. Note that in this model “time-series” should be interpreted as a set of uncorrelated samples, not a temporal sequence. Additionally, the s parameter should contain property maps of type vector<double>, with values in the range \([-1,1]\).

Methods

collect_marginal([g])

Collect marginal inferred network during MCMC runs.

collect_marginal_multigraph([g])

Collect marginal latent multigraph during MCMC runs.

copy(**kwargs)

Return a copy of the state.

entropy([latent_edges, density])

Return the entropy, i.e. negative log-likelihood.

get_block_state()

Return the underlying block state, which can be either BlockState or NestedBlockState.

get_edge_prob(u, v, x[, entropy_args, epsilon])

Return conditional posterior log-probability of edge \((u,v)\).

get_edges_prob(elist[, entropy_args, epsilon])

Return conditional posterior log-probability of an edge list, with shape \((E,2)\).

get_graph()

Return the current inferred graph.

get_x()

Return edge couplings.

mcmc_sweep([r, p, pstep, h, hstep, xstep, ...])

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.

set_params(params)

Sets the model parameters via the dictionary params.

set_state(g, w)

virtual_add_edge(u, v[, entropy_args])

virtual_remove_edge(u, v[, entropy_args])

collect_marginal(g=None)#

Collect marginal inferred network during MCMC runs.

Parameters:
gGraph (optional, default: None)

Previous marginal graph.

Returns:
gGraph

New marginal graph, 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.

collect_marginal_multigraph(g=None)#

Collect marginal latent multigraph during MCMC runs.

Parameters:
gGraph (optional, default: None)

Previous marginal multigraph.

Returns:
gGraph

New marginal graph, 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.

copy(**kwargs)#

Return a copy of the state.

entropy(latent_edges=True, density=True, **kwargs)#

Return the entropy, i.e. negative log-likelihood.

get_block_state()#

Return the underlying block state, which can be either BlockState or NestedBlockState.

get_edge_prob(u, v, x, entropy_args={}, epsilon=1e-08)#

Return conditional posterior log-probability of edge \((u,v)\).

get_edges_prob(elist, entropy_args={}, epsilon=1e-08)#

Return conditional posterior log-probability of an edge list, with shape \((E,2)\).

get_graph()#

Return the current inferred graph.

get_x()#

Return edge couplings.

mcmc_sweep(r=0.5, p=0.1, pstep=0.1, h=0.1, hstep=1, xstep=0.1, multiflip=True, **kwargs)#

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 parameter h controls the relative probability with which moves for the parameters r_v will be attempted, and hstep is the size of the step. The parameter p controls the relative probability with which moves for the parameters global_beta and r will be attempted, and pstep is the size of the step. The paramter xstep determines the size of the attempted steps for the edge coupling parameters.

The remaining keyword parameters will be passed to mcmc_sweep() or multiflip_mcmc_sweep(), if multiflip=True.

multiflip_mcmc_sweep(**kwargs)#

Alias for mcmc_sweep() with multiflip=True.

set_params(params)#

Sets the model parameters via the dictionary params.

set_state(g, w)#
virtual_add_edge(u, v, entropy_args={})#
virtual_remove_edge(u, v, entropy_args={})#