class neurotools.networks.measures.ThresholdNetworkMeasures(threshold=0.2, threshold_type='abs', threshold_method='value', to_compute='avg_degree', ensure='edge', ensure_incr=0.01)#

This class is designed for thresholding and then extracting network measures from an input correlation matrix.

  • threshold (float, optional) –

    A floating point threshold between 0 and 1. This represents the threshold at which a connection in the passed data needs to be in order for it to be set as an edge. The type of threshold_method also changes how this threshold behaves.

    If ‘density’, then this value represents the percent of edges to keep, out of all possible edges.

    default = .2

  • threshold_type ({'abs', 'pos', 'neg'}) –

    The type of thresholding, e.g., should the threshold be applied to:

    • ’abs’

      The absolute value of the connections

    • ’pos’

      Only consider edges as passed the threshold if >= self.threshold

    • ’neg’

      Only consider edges as passed the if <= self.threshold

    default = 'abs'

  • threshold_method ({'value', 'density'}, optional) –

    The method for thresholding. The two defined options are either to define an edge strictly by value, e.g., if threshold_type is ‘abs’, and threshold is .2, then any connection greater than or equal to .2 will be set as an edge.

    Alternatively, you may specify that the threshold be treated as a density. What this means is that if the threshold is set to for example .2, then the top 20% of edges by weight will be set as an edge, regardless of the actual value of the edge.

    The passed percentage will be considered out of all the possible edges. This will be used to select a threshold value, rounding up if needed, then all edges above or equal to the threshold will be kept (positive or abs case) or in neg case, all edges less than or equal.

    default = 'value'

  • to_compute

    Either a single str representing a network measure to compute, or a list of valid measures. You may also pass any custom function which accepts one argument G, and returns a value.
    The following global measures are currently implemented as options:

ensure{None, ‘edge’, ‘is_conn’, float}, optional

When constructing the thresholded network, you may optionally specify what trait of the network to ensure according to the passed threshold and threshold type. By default, this value will be set to ‘edge’, which means, if the passed settings do not ensure atleast 1 edge, the threshold will be incremented by the ensure_incr, default = .01, until there is atleast one edge.

Alternatively, you may pass ‘is_conn’ to specify that the network should be connected, that is, every node can be reached by every other. Or None, to do no checks (which may result in some kind of error).

Lastly, you may pass a float value between 0 and 1, which specifies that the criteria check the size of the largest connected component relative to the total number of nodes. For example, passing 1 is the same as passing ‘is_conn’, where the largest connected component is the same size as the network, and a value of .5 would be that atleast half the nodes are connected to each other.

default = 'edge'
ensure_incrfloat, optional

The amount in which to increment each time when checking for an ensure criteria. Note if ensure is None, this parameter is not used. Also note that this value in the case of threshold_method by value, is repeatedly decremented from the original passed threshold, unless the threshold type is ‘neg’, in that case it will be incremented.

In the case of threshold_type is density, this value will always be incremented, as only positive thresholds make sense for density.

default = .01