brainconn.clustering.consensus_und

consensus_und(D, tau, reps=1000)[source]

This algorithm seeks a consensus partition of the agreement matrix D. The algorithm used here is almost identical to the one introduced in Lancichinetti & Fortunato (2012): The agreement matrix D is thresholded at a level TAU to remove an weak elements. The resulting matrix is then partitions REPS number of times using the Louvain algorithm (in principle, any clustering algorithm that can handle weighted matrixes is a suitable alternative to the Louvain algorithm and can be substituted in its place). This clustering produces a set of partitions from which a new agreement is built. If the partitions have not converged to a single representative partition, the above process repeats itself, starting with the newly built agreement matrix.

NOTE: In this implementation, the elements of the agreement matrix must be converted into probabilities.

NOTE: This implementation is slightly different from the original algorithm proposed by Lanchichinetti & Fortunato. In its original version, if the thresholding produces singleton communities, those nodes are reconnected to the network. Here, we leave any singleton communities disconnected.

Parameters:
  • D (NxN numpy.ndarray) – agreement matrix with entries between 0 and 1 denoting the probability of finding node i in the same cluster as node j
  • tau (float) – threshold which controls the resolution of the reclustering
  • reps (int) – number of times the clustering algorithm is reapplied. default value is 1000.
Returns:

ciu – consensus partition

Return type:

Nx1 numpy.ndarray