SBM

SBM module

class markovianSBM.SBM.SBM(n, K, ini_distribution='uniform', framework='iid', X=None, Q=None, P=None, save_B_matrices=False)[source]

Bases: RelaxedKmeans, Clustering, Estimation, BaumWelch

Main class building the graph and running the algorithm to recover communities.

adjacency_matrix(X=None)[source]

Builds the adjacency matrix of the graph.

Parameters

X – Pre-defined adjacency matrix

bernoulli(q)[source]

Sample from the Bernoulli distribution with parameter q.

edges_matrix(Q)[source]

Builds the connectivity matrix Q.

Parameters

Q – Connectivity matrix of size $K imes K$

effectif_clusters()[source]

Computes the sizes of each clusters

estimate_partition()[source]

Runs the algorithm to estimate communities of the nodes.

generate_clusters(P)[source]

Samples the communities of the nodes.

Parameters

P – Transition matrix of the Markov chain of size $K imes K$

initial_distribution()[source]

Defines the distribution of the community of the first node of the graph.

..note: You can add distribution by yourself in the method

next_state(i)[source]

Method used to sample the community of the next code knowing that the community of the previous node was i.

Parameters

i – Integer representing the community of the current node

proportion_error()[source]

Compute the misclassification error of our estimated clustering of the nodes.