brainconn.reference.null_model_und_sign

null_model_und_sign(W, bin_swaps=5, wei_freq=0.1)[source]

This function randomizes an undirected network with positive and negative weights, while preserving the degree and strength distributions. This function calls randmio_und.m

Parameters:
  • W (NxN numpy.ndarray) – undirected weighted connection matrix
  • bin_swaps (int) – average number of swaps in each edge binary randomization. Default value is 5. 0 swaps implies no binary randomization.
  • wei_freq (float) –

    frequency of weight sorting in weighted randomization. 0<=wei_freq<1. wei_freq == 1 implies that weights are sorted at each step. wei_freq == 0.1 implies that weights sorted each 10th step (faster,

    default value)

    wei_freq == 0 implies no sorting of weights (not recommended)

Returns:

  • W0 (NxN numpy.ndarray) – randomized weighted connection matrix
  • R (4-tuple of floats) – Correlation coefficients between strength sequences of input and output connection matrices, rpos_in, rpos_out, rneg_in, rneg_out

Notes

The value of bin_swaps is ignored when binary topology is fully
connected (e.g. when the network has no negative weights).
Randomization may be better (and execution time will be slower) for
higher values of bin_swaps and wei_freq. Higher values of bin_swaps may enable a more random binary organization, and higher values of wei_freq may enable a more accurate conservation of strength sequences.
R are the correlation coefficients between positive and negative
strength sequences of input and output connection matrices and are used to evaluate the accuracy with which strengths were preserved. Note that correlation coefficients may be a rough measure of strength-sequence accuracy and one could implement more formal tests (such as the Kolmogorov-Smirnov test) if desired.