probinet.synthetic.multilayer#

Code to generate multilayer networks with non-negative and discrete weights, and whose nodes are associated with one categorical attribute. Self-loops are removed and only the largest connected component is considered.

Functions

output_design_matrix(X, out_folder, label)

Save the design matrix tensor to a file.

pi_ik_matrix(u, v, beta)

Compute the mean pi_ik for all entries.

plot_X(X[, cmap])

Plot the design matrix produced by the generative algorithm.

Classes

BaseSyntheticNetwork([N, L, K, Z, ...])

A base abstract class for generation and management of synthetic networks.

SyntheticMTCOV(**kwargs)

Create a synthetic, possibly directed, and weighted network (possibly multilayer) by a standard mixed-membership stochastic block-model - It models marginals (iid assumption) with Poisson distributions

class probinet.synthetic.multilayer.BaseSyntheticNetwork(N: int = 100, L: int = 1, K: int = 2, Z: int = 2, out_folder: Path = PosixPath('outputs'), output_net: bool = False, show_details: bool = False, show_plots: bool = False, rng: Generator | None = None, **kwargs)[source]#

A base abstract class for generation and management of synthetic networks.

Suitable for representing any type of synthetic network.

class probinet.synthetic.multilayer.SyntheticMTCOV(**kwargs)[source]#

Create a synthetic, possibly directed, and weighted network (possibly multilayer) by a standard mixed-membership stochastic block-model - It models marginals (iid assumption) with Poisson distributions

build_X(attributes: ndarray | None = None)[source]#

Generate the design matrix.

Parameters:

attributes (np.ndarray, optional) – The latent variables representing the contribution of the attributes. If None, the attributes will be generated.

Raises:

ValueError – If the shape of the parameter beta is not (K, Z).

build_Y(parameters=None)[source]#

Generate network layers G using the latent variables, with the generative model A_ij ~ P(A_ij|u,v,w)

init_mmsbm_params(**kwargs)[source]#

Check MMSBM-specific parameters

probinet.synthetic.multilayer.output_design_matrix(X, out_folder, label)[source]#

Save the design matrix tensor to a file.

INPUT#

Xnp.ndarray

One-hot encoding of design matrix.

out_folderstr

Path to store the design matrix.

labelstr

Label name to store the design matrix.

probinet.synthetic.multilayer.pi_ik_matrix(u: ndarray, v: ndarray, beta: ndarray) ndarray[source]#

Compute the mean pi_ik for all entries.

Parameters:
  • u (np.ndarray) – Out-going membership matrix.

  • v (np.ndarray) – In-coming membership matrix.

  • beta (np.ndarray) – Affinity matrix.

Returns:

pi

Return type:

np.ndarray

probinet.synthetic.multilayer.plot_X(X, cmap='PuBuGn')[source]#

Plot the design matrix produced by the generative algorithm.

INPUT#

Xnp.ndarray

Design matrix.

cmapMatplotlib object

Colormap used for the plot.