derive_temporalnetwork

derive_temporalnetwork(data, params)[source]

Derives connectivity from the data.

A lot of data is inherently built with edges
(e.g. communication between two individuals).
However other networks are derived from the covariance of time series
(e.g. brain networks between two regions).
Covariance based metrics deriving time-resolved networks can be done in multiple ways.
There are other methods apart from covariance based.
Derive a weight vector for each time point and then the corrrelation coefficient
for each time point.
data : array
Time series data to perform connectivity derivation on. (Default dimensions are: (time as rows, nodes as columns). Change params{‘dimord’} if you want it the other way (see below).
params : dict
Parameters for each method (see below).
method : str
method: “distance”,”slidingwindow”, “taperedslidingwindow”,

“jackknife”, “multiplytemporalderivative”. Alternatively, method can be a weight matrix of size time x time.

Different methods have method specific paramaters (see below)

postpro : “no” (default). Other alternatives are: “fisher”, “boxcox”, “standardize”

and any combination seperated by a + (e,g, “fisher+boxcox”).
See postpro_pipeline for more information.
dimord : str
Dimension order: ‘node,time’ (default) or ‘time,node’. People like to represent their data differently and this is an easy way to be sure that you are inputing the data in the correct way.
analysis_id : str or int
add to identify specfic analysis. Generated report will be placed in ‘./report/’ + analysis_id + ‘/derivation_report.html
report : bool
False by default. If true, A report is saved in ./report/[analysis_id]/derivation_report.html if “yes”
report_path : str
String where the report is saved. Default is ./report/[analysis_id]/derivation_report.html

Distance metric calculates 1/Distance metric weights, and scales between 0 and 1. W[t,t] is excluded from the scaling and then set to 1.

params[‘distance’]: str
Distance metric (e.g. ‘euclidean’). See teneto.utils.get_distance_function for more info
params[‘windowsize’] : int
Size of window.
params[‘windowsize’] : int
Size of window.
params[‘distribution’] : str
Scipy distribution (e.g. ‘norm’,’expon’). Any distribution here: https://docs.scipy.org/doc/scipy/reference/stats.html
params[‘distribution_params’] : dict

Dictionary of distribution parameter, excluding the data “x” to generate pdf.

The data x should be considered to be centered at 0 and have a length of window size.
(i.e. a window size of 5 entails x is [-2, -1, 0, 1, 2] a window size of 6 entails [-2.5, -1.5, 0.5, 0.5, 1.5, 2.5])

Given x params[‘distribution_params’] contains the remaining parameters.

e.g. normal distribution requires pdf(x, loc, scale) where loc=mean and scale=std.

Say we have a gaussian distribution, a window size of 21 and params[‘distribution_params’] = {‘loc’: 0, ‘scale’: 5}.
This will lead to a gaussian with its peak at in the middle of each window with a standard deviation of 5.
params[‘windowsize’] : int
Size of window.

No parameters are necessary.

Optional parameters:

params[‘weight-var’] : array, (optional)
NxN array to weight the JC estimates (standerdized-JC*W). If weightby is selected, do not standerdize in postpro.
params[‘weight-mean’] : array, (optional)
NxN array to weight the JC estimates (standerdized-JC+W). If weightby is selected, do not standerdize in postpro.

No parameters are necessary.

Returns:G – Connectivity estimates (nodes x nodes x time)
Return type:array

About the general weighted pearson approach used for most methods, see: Thompson & Fransson (2019) A common framework for the problem of deriving estimates of dynamic functional brain connectivity. Neuroimage. (https://doi.org/10.1016/j.neuroimage.2017.12.057)

See also

postpro_pipeline, gen_report