netneurotools.cluster.find_consensus

netneurotools.cluster.find_consensus(assignments, null_func=<function mean>, return_agreement=False, seed=None)[source]

Find consensus clustering labels from cluster solutions in assignments.

Parameters:
  • assignments ((N, M) array_like) – Array of M clustering solutions for N samples (e.g., subjects, nodes, etc). Values of array should be integer-based cluster assignment labels

  • null_func (callable, optional) – Function used to generate null model when performing consensus-based clustering. Must accept a 2D array as input and return a single value. Default: numpy.mean()

  • return_agreement (bool, optional) – Whether to return the thresholded N x N agreement matrix used in generating the final consensus clustering solution. Default: False

  • seed ({int, np.random.RandomState instance, None}, optional) – Seed for random number generation. Used when permuting cluster assignments during generation of null model. Default: None

Returns:

consensus – Consensus cluster labels

Return type:

(N,) numpy.ndarray

References

Bassett, D. S., Porter, M. A., Wymbs, N. F., Grafton, S. T., Carlson, J. M., & Mucha, P. J. (2013). Robust detection of dynamic community structure in networks. Chaos: An Interdisciplinary Journal of Nonlinear Science, 23(1), 013142.

Examples using netneurotools.cluster.find_consensus

Consensus clustering with modularity maximization

Consensus clustering with modularity maximization