๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Hypergraph-MTยถ

Submodulesยถ

hypergraphx.communities.hypergraph_mt.model moduleยถ

class hypergraphx.communities.hypergraph_mt.model.HypergraphMT(noise_input_par=0.001, min_value_par=1e-05, max_value_par=100.0, n_realizations=10, max_iter=500, check_convergence_every=1, tolerance=0.1, threshold_for_convergence=15, verbose=True)[source]ยถ

Bases: object

Implementation of the Hypergraph-MT probabilistic model from

โ€œInference of hyperedges and overlapping communities in hypergraphsโ€, Contisciani M., Battiston F., De Bacco C.

The probabilistic generative model infers overlapping communities in hypergraphs. It is a mixed-membership model where we assume an assortative structure. The inference is performed using an efficient expectation-maximization (EM) algorithm that exploits the sparsity of the network, leading to an efficient and scalable implementation.

check_u(i, ks)[source]ยถ

Check the updated value of u[i].

static enforce_constraint_u(num, den)[source]ยถ

Return the lagrangian multiplier to enforce the constraint on the matrix u.

Parameters:
  • num (numerator of the update of the membership matrix u.)

  • den (denominator of the update of the membership matrix u.)

Returns:

lambda_i

Return type:

lagrangian multiplier.

fit(hypergraph, K, seed=None, normalizeU=False, baseline_r0=True, **extra_params)[source]ยถ

Perform community detection on hypergraphs with a mixed-membership probabilistic model.

Parameters:
  • hypergraph (the hypergraph to perform inference on.)

  • K (number of communities.)

  • seed (random seed.)

  • normalizeU (if True, then the membership matrix u is normalized such that every row sums to 1.)

  • baseline_r0 (if True, then for the first iteration u is initialized around the solution of the Hypergraph Spectral Clustering.)

  • **extra_params (additional keyword arguments handed to __check_fit_params to handle u and w.)

Returns:

  • u_f (membership matrix of dimension (N, K).)

  • w_f (affinity matrix of dimension (D-1, K).)

  • maxL (maximum log-likelihood value.)

hypergraphx.communities.hypergraph_mt.model.calculate_u_HySC(hypergraph, K, seed)[source]ยถ

Calculate the memberships with the Hypergraph Spectral Clustering.

Parameters:
  • hypergraph (the hypergraph to perform inference on.)

  • K (number of communities.)

  • seed (random seed.)

Return type:

Membership matrix.

hypergraphx.communities.hypergraph_mt.model.func_lagrange_multiplier(lambda_i, num, den)[source]ยถ

Return the objective function to find the lagrangian multiplier to enforce the constraint on the matrix u.

hypergraphx.communities.hypergraph_mt.model.u0_w0_from_file(filename, par)[source]ยถ

Load an array from a .npz file.

Parameters:
  • filename (path of the stored file.)

  • par (name of the parameter to import.)

Return type:

Array to use as initialization for the given parameter.

hypergraphx.communities.hypergraph_mt.model.u0_w0_from_nparray(input_array)[source]ยถ

Import an array.

Module contentsยถ