probinet.models.jointcrep#
Class definition of JointCRep, the algorithm to perform inference in networks with reciprocity. The latent variables are related to community memberships and a pair interaction value [CSDB22].
Classes
|
Class definition of JointCRep, the algorithm to perform inference in networks with reciprocity. |
- class probinet.models.jointcrep.JointCRep(**kwargs: Any)[source]#
Class definition of JointCRep, the algorithm to perform inference in networks with reciprocity.
- compute_likelihood() float [source]#
Compute the log-likelihood of the data.
- Returns:
loglik – Log-likelihood value.
- Return type:
float
- eta_fix_point() float [source]#
Compute the fix point of the pair interaction coefficient eta. :returns: eta – Fix point of the pair interaction coefficient eta. :rtype: float
- fit(gdata: GraphData, K: int = 3, initialization: int = 0, eta0: float | None = None, undirected: bool = False, assortative: bool = True, fix_eta: bool = False, fix_communities: bool = False, fix_w: bool = False, use_approximation: bool = False, out_inference: bool = True, out_folder: Path = PosixPath('outputs'), end_file: str | None = None, files: PathLike | None = None, rng: Generator | None = None, **_kwargs: Any) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], float, float] [source]#
Model directed networks by using a probabilistic generative model based on a Bivariate Bernoulli distribution that assumes community parameters and a pair interaction coefficient as latent variables. The inference is performed via the EM algorithm.
- Parameters:
gdata – Graph adjacency tensor.
K – Number of communities, by default 3.
initialization – Indicator for choosing how to initialize u, v, and w. If 0, they will be generated randomly; 1 means only the affinity matrix w will be uploaded from file; 2 implies the membership matrices u and v will be uploaded from file, and 3 all u, v, and w will be initialized through an input file, by default 0.
eta0 – Initial value for the reciprocity coefficient, by default None.
undirected – Flag to call the undirected network, by default False.
assortative – Flag to call the assortative network, by default True.
fix_eta – Flag to fix the eta parameter, by default False.
fix_communities – Flag to fix the community memberships, by default False.
fix_w – Flag to fix the affinity tensor, by default False.
use_approximation – Flag to use approximation in updates, by default False.
out_inference – Flag to evaluate inference results, by default True.
out_folder – Output folder for inference results, by default OUTPUT_FOLDER.
end_file – Suffix for the evaluation file, by default None.
files – Path to the file for initialization, by default None.
rng – Random number generator, by default None.
- Returns:
u_f – Out-going membership matrix.
v_f – In-coming membership matrix.
w_f – Affinity tensor.
eta_f – Pair interaction coefficient.
maxL – Maximum log-likelihood.