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
|
Save the design matrix tensor to a file. |
|
Compute the mean pi_ik for all entries. |
|
Plot the design matrix produced by the generative algorithm. |
Classes
|
A base abstract class for generation and management of synthetic networks. |
|
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).
- 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