local_variation¶
-
local_variation
(data)[source]¶ Calculates the local variaiont of inter-contact times. [LV-1], [LV-2]
Parameters: data (array, dict) – This is either (1) temporal network input (graphlet or contact) with nettype: ‘bu’, ‘bd’. (2) dictionary of ICTs (output of intercontacttimes). Returns: LV – Local variation per edge. Return type: array Notes
The local variation is like the bursty coefficient and quantifies if a series of inter-contact times are periodic, random or Poisson distributed or bursty.
It is defined as:
\[LV = {3 \over {n-1}}\sum_{i=1}^{n-1}{{{\iota_i - \iota_{i+1}} \over {\iota_i + \iota_{i+1}}}^2}\]Where \(\iota\) are inter-contact times and i is the index of the inter-contact time (not a node index). n is the number of events, making n-1 the number of inter-contact times.
The possible range is: \(0 \geq LV \gt 3\).
When periodic, LV=0, Poisson, LV=1 Larger LVs indicate bursty process.
Examples
First import all necessary packages
>>> import teneto >>> import numpy as np
Now create 2 temporal network of 2 nodes and 60 time points. The first has periodict edges, repeating every other time-point:
>>> G_periodic = np.zeros([2, 2, 60]) >>> ts_periodic = np.arange(0, 60, 2) >>> G_periodic[:,:,ts_periodic] = 1
The second has a more bursty pattern of edges:
>>> ts_bursty = [1, 8, 9, 32, 33, 34, 39, 40, 50, 51, 52, 55] >>> G_bursty = np.zeros([2, 2, 60]) >>> G_bursty[:,:,ts_bursty] = 1
Now we call local variation for each edge.
>>> LV_periodic = teneto.networkmeasures.local_variation(G_periodic) >>> LV_periodic array([[nan, 0.], [ 0., nan]])
Above we can see that between node 0 and 1, LV=0 (the diagonal is nan). This is indicative of a periodic contacts (which is what we defined). Doing the same for the second example:
>>> LV_bursty = teneto.networkmeasures.local_variation(G_bursty) >>> LV_bursty array([[ nan, 1.28748748], [1.28748748, nan]])
When the value is greater than 1, it indicates a bursty process.
nans are returned if there are no intercontacttimes
References
[LV-1] Shinomoto et al (2003) Differences in spiking patterns among cortical neurons. Neural Computation 15.12 [Link] [LV-2] Followed eq., 4.34 in Masuda N & Lambiotte (2016) A guide to temporal networks. World Scientific. Series on Complex Networks. Vol 4 [Link]