dyconnmap.ts package¶
Submodules¶
dyconnmap.ts.ci module¶
Complexity Index
Complexity index (Janson2004, Rapp2007) computes the l-subword complexity (l-subword spectrum) of a one-dimensional, symbolic (integer) time series, by finding the number of distinct subwords of length l. The total complexity is given by the sum of all subwords of different lengths. The unnormalized measure can be used to compare sequences of equal lengths.
Notes¶
This is a direct translation from the Complexity toolbox available at http://users.auth.gr/~stdimitr/files/software/complexitiy.rar
Original author is Stravros Dimitriadis <stidimitriadis@gmail.com>
- Janson2004
Janson, S., Lonardi, S., & Szpankowski, W. (2004). On average sequence complexity. Theoretical Computer Science, 326(1-3), 213-227.
- Rapp2007
Rapp, P. E. (2007). Quantitative characterization of animal behavior following blast exposure. Cognitive neurodynamics, 1(4), 287-293.
-
dyconnmap.ts.ci.
complexity_index
(x, sub_len=-1, normalize=False, iterations=100)[source]¶ Complexity Index
- Parameters
x : array-like, shape(n_samples)
Input symbolic time series.
sub_len : int
Maximum subword length. Default is len(x) - 1.
normalize : bool
Normalize result. Default is False.
iterationss : int
Number of iterations to perform randomization. Default is 100.
- Returns
normal_ci : float
The computed omplexity index after normalization against the randomization procedure.
ci : float
The computed complexity index.
spectrum : array-like
A list of the number of distinct subwords of length 1, up to the size of the input symbolic time series.
dyconnmap.ts.cv module¶
Coefficient of Variation
dyconnmap.ts.dcorr module¶
Distance Correlation
Notes¶
Snippet adapted from: https://gist.github.com/Satra/aa3d19a12b74e9ab7941
dyconnmap.ts.embed_delay module¶
When dealing with non-linear time series analysis, it is common to reconstruct hem as time delay vectors in phase space. This new reconstruction, describes the tmporal evolution of a system in a state space; a trajectory of interchanging states. The need for this state space, stems from the fact that the original system may contain latent and unobserved variables that we would like to expose. Thus, we construct \(m\)-dimensional phase vectors from \(\tau\)-time delayed samples (Takens1981_):
This new space, is shown to preserve the dynamics properties of the original phase space. For more on the subject, the interested readers are encouraged to consult the work of Bradley and Kantz (Bradley2015).
- Taken1981
Takens, F. (1981). Detecting strange attractors in turbulence. Lecture notes in mathematics, 898(1), 366-381.
- Bradley2015
Bradley, E., & Kantz, H. (2015). Nonlinear time-series analysis revisited. Chaos: An Interdisciplinary Journal of Nonlinear Science, 25(9), 097610.
dyconnmap.ts.entropy module¶
Entropy
dyconnmap.ts.fisher_score module¶
Fisher Scoring Algorithm
- Stam2007
Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human brain mapping, 28(11), 1178-1193.
- Hardmeier2014
Hardmeier, M., Hatz, F., Bousleiman, H., Schindler, C., Stam, C. J., & Fuhr, P. (2014). Reproducibility of functional connectivity and graph measures based on the phase lag index (PLI) and weighted phase lag index (wPLI) derived from high resolution EEG. PloS one, 9(10), e108648.
dyconnmap.ts.fisher_z module¶
Fisher’s Z Transformation
- Stam2007
Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human brain mapping, 28(11), 1178-1193.
- Hardmeier2014
Hardmeier, M., Hatz, F., Bousleiman, H., Schindler, C., Stam, C. J., & Fuhr, P. (2014). Reproducibility of functional connectivity and graph measures based on the phase lag index (PLI) and weighted phase lag index (wPLI) derived from high resolution EEG. PloS one, 9(10), e108648.
-
dyconnmap.ts.fisher_z.
fisher_z
(data)[source]¶ Fisher’s z-transformation
For a given dataset \(p\) bound to \([0.0, 1.0]\), we can use Fisher’s z-transformation to normalize it in an approximately Gaussian distribution.
This transformation is computed as follows:
\[z_p := \frac{1}{2} \text{ln} \left ( \frac{1+p}{1-p} \right ) = \text{arctanh}(p)\]
-
dyconnmap.ts.fisher_z.
fisher_z_plv
(data)[source]¶ - \[z^p_j = sin^{-1}(2 * PLV_j - 1)\]
- Mormann2005
Mormann, F., Fell, J., Axmacher, N., Weber, B., Lehnertz, K., Elger, C. E., & Fernández, G. (2005). Phase/amplitude reset and theta–gamma interaction in the human medial temporal lobe during a continuous word recognition memory task. Hippocampus, 15(7), 890-900.
dyconnmap.ts.fnn module¶
False Nearest Neighbors
- Kennel1992
Kennel, M. B., Brown, R., & Abarbanel, H. D. (1992). Determining embedding dimension for phase-space reconstruction using a geometrical construction. Physical review A, 45(6), 3403.
- Abarbane2012
Abarbanel, H. (2012). Analysis of observed chaotic data. Springer Science & Business Media.
-
dyconnmap.ts.fnn.
fnn
(ts, tau, max_dim=20, neighbors_reduction=0.1, rtol=15.0, atol=2.0)[source]¶ False Nearest Neighbors
- Parameters
ts : array-like, 1d
tau : int
Time-delay parameter.
max_dim : int
Maximum embedding dimension.
neighbors_reduction : float
Maximum percentage of neighbors reduction. Default ‘0.10’ (10%).
rtol : float
First threshold, criterion to identify a false neighbor. (Neighborhood size)
atol : float
Second threshold, criterion to identify a false neighbor.
- Returns
min_dimension : int
Minimum embedding dimension.
Notes
The execution stops either when the maxium number of embedding dimensions is reached, or the the number of neighbors is reduced to specific percentage.
dyconnmap.ts.icc module¶
Intra-class Correlation (3, 1)
Notes¶
Based on the code available at <https://github.com/ekmolloy/fmri_test-retest>
- McGraw1996
McGraw, K. O., & Wong, S. P. (1996). Forming inferences about some intraclass correlation coefficients. Psychological methods, 1(1), 30.
- Birn2013
Birn, R. M., Molloy, E. K., Patriat, R., Parker, T., Meier, T. B., Kirk, G. R., … & Prabhakaran, V. (2013). The effect of scan length on the reliability of resting-state fMRI connectivity estimates. Neuroimage, 83, 550-558.
dyconnmap.ts.markov_matrix module¶
Markov matrix
Generation of markov matrix and some related state transition features.
-
dyconnmap.ts.markov_matrix.
markov_matrix
(symts, states_from_length=True)[source]¶ Markov Matrix
Markov matrix (also refered as “transition matrix”) is a square matrix that tabulates the observed transition probabilities between symbols for a finite Markov Chain. It is a first-order descriptor by which the next symbol depends only on the current symbol (and not on the previous ones); a Markov Chain model.
A transition matrix is formally depicted as:
Given the probability \(Pr(j|i)\) of moving between \(i\) and \(j\) elements, the transition matrix is depicted as:
\[\begin{split}P = \begin{pmatrix} P_{1,1} & P_{1,2} & \ldots & P_{1,j} & \ldots & P_{1,S} \\ P_{2,1} & P_{2,2} & \ldots & P_{2,j} & \ldots & P_{2,S} \\ \vdots & \vdots & \ddots & \vdots & \ddots & \vdots \\ P_{i,1} & P_{i,2} & \ldots & P_{i,j} & \ldots & P_{i,S} \\ \vdots & \vdots & \ddots & \vdots & \ddots & \vdots \\ P_{S,1} & P_{S,2} & \ldots & P_{S,j} & \ldots & P_{S,S} \\ \end{pmatrix}\end{split}\]Since the transition matrix is row-normalized, so as the total transition probability from state \(i\) to all the others must be equal to \(1\).
For more properties consult, among other links WolframMathWorld_ and WikipediaMarkovMatrix_.
- WolframMathWorld
- WikipediaMarkovMatrix
- Parameters
symts : array-like, shape(N)
One-dimensional discrete time series.
states_from_length: bool or int, optional :
Used to account symbolic time series in which not all the symbols are present. That may happen when for example the symbols are drawn from different distributions. Default True, the size of the resulting Markov Matrix is equal to the number of unique symbols present in the time series. If False, the size will be the highest symbolic state + 1. You may also speficy the highest (inclusive) symbolic state.
- Returns
mtx : matrix
The transition matrix. The size depends the parameter states_from_length.
-
dyconnmap.ts.markov_matrix.
occupancy_time
(symts, symbol_states=None, weight=None)[source]¶ Occupancy Time
- Parameters
symts : :
symbol_states : int
The maximum number of symbols. This is useful to define in case your symbolic timeseries skips some states, in which case would produce a matrix of different size.
weight : float
The weights of the reuslting transition symbols. Default len(symts).
- Returns
oc : :
symbols : :
dyconnmap.ts.ordinal_pattern_similarity module¶
Ordinal Pattern Similarity
- Stam2007
Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human brain mapping, 28(11), 1178-1193.
- Hardmeier2014
Hardmeier, M., Hatz, F., Bousleiman, H., Schindler, C., Stam, C. J., & Fuhr, P. (2014). Reproducibility of functional connectivity and graph measures based on the phase lag index (PLI) and weighted phase lag index (wPLI) derived from high resolution EEG. PloS one, 9(10), e108648.
-
dyconnmap.ts.ordinal_pattern_similarity.
ordinal_pattern_similarity
(signal1, signal2, m, tau)[source]¶ Ordinal Pattern Similarity
- Parameters
signal1 : :
signal2 : :
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
dissimilarity : float
The dissimilarity index as computed from the ordinal patterns.
ordinal_patterns : array
The time series of ordinal patterns for input signals.
patterns_distribution : array
Distribution of the patterns.
Notes
The results may vary from the original MATLAB script because of the permutations’ order.
The permutations are generated from \([1, dim+1]\) so there are no occurances of \(0.\)
The extra \(+1\) in the lines .. python: I = sklearn.preprocessing.normalize(I + 1) is in order to avoid :math:`0`s.
dyconnmap.ts.permutation_entropy module¶
Permutation Entropy
- Stam2007
Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human brain mapping, 28(11), 1178-1193.
- Hardmeier2014
Hardmeier, M., Hatz, F., Bousleiman, H., Schindler, C., Stam, C. J., & Fuhr, P. (2014). Reproducibility of functional connectivity and graph measures based on the phase lag index (PLI) and weighted phase lag index (wPLI) derived from high resolution EEG. PloS one, 9(10), e108648.
-
dyconnmap.ts.permutation_entropy.
permutation_entropy
(signal, m, tau)[source]¶ Permutation Entropy
- Parameters
signal : array-like, shape(N)
Symblic time series (1D).
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
pe : float
Permutation entropy.
npe : float
Normalized permutation entropy.
dyconnmap.ts.rr_order_patterns module¶
Order Reccurence Plot
- Stam2007
Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human brain mapping, 28(11), 1178-1193.
- Hardmeier2014
Hardmeier, M., Hatz, F., Bousleiman, H., Schindler, C., Stam, C. J., & Fuhr, P. (2014). Reproducibility of functional connectivity and graph measures based on the phase lag index (PLI) and weighted phase lag index (wPLI) derived from high resolution EEG. PloS one, 9(10), e108648.
-
dyconnmap.ts.rr_order_patterns.
rr_order_patterns
(signal1, signal2, m, tau)[source]¶ - Parameters
signal1 : :
signal2 : :
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
cstr : float
Coupling strength.
Notes
The results may vary from the original MATLAB script because of the permutations’ order.
The results may vary from the original MATLAB script because of the order of the indices in the :python:`numpy.where`.
The permutations are generated from \([1, dim+1]\) so there are no occurances of \(0.\)
The extra \(+1\) in the lines .. python: I = sklearn.preprocessing.normalize(I + 1) is in order to avoid :math:`0`s.
dyconnmap.ts.sampen module¶
Sample Entropy
Notes¶
Based on https://nl.mathworks.com/matlabcentral/fileexchange/35784-sample-entropy
- Stam2007
Stam, C. J., Nolte, G., & Daffertshofer, A. (2007). Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Human brain mapping, 28(11), 1178-1193.
- Hardmeier2014
Hardmeier, M., Hatz, F., Bousleiman, H., Schindler, C., Stam, C. J., & Fuhr, P. (2014). Reproducibility of functional connectivity and graph measures based on the phase lag index (PLI) and weighted phase lag index (wPLI) derived from high resolution EEG. PloS one, 9(10), e108648.
-
dyconnmap.ts.sampen.
sample_entropy
(data, dim=2, tau=None, r=None)[source]¶ Sample Entropy
- Parameters
data : array-like, shape(n_samples)
Symbolic time series.
dim : int
Embedding dimension. Default 2.
tau : int
Delay time for downsampling. Is None, 1 is passed.
r : float
Tolerance factor. If None, 0.2 * std(data) is passed.
- Returns
SampEn : float
Sample entropy.
See also
dyconnmap.ts.embed_ts
Embedded timeseries
dyconnmap.ts.ste module¶
Symbolic Transfer Entropy
-
dyconnmap.ts.ste.
entropy_reduction_rate
(sym_ts)[source]¶ Entropy Reduction Rate
- Parameters
sym_ts : array-like, shape(n_samples)
Input symblic time series.
- Returns
entredrate : float
The estimated entropy reduction rate.
-
dyconnmap.ts.ste.
symoblic_transfer_entropy
(x, y, s=1, delay=0, verbose=False)[source]¶ Symbolic Tranfer Entropy
- Parameters
x : array-like, shape(N)
Symblic time series (1D).
y : array-like, shape(N)
Symbolic time series (1D).
s : int
Embedding dimension.
delay : int
Time delay parameter
verbose : boolean
Print computation messages.
- Returns
tent_diff : float
The difference of the tranfer entropies of the two time series.
tentxy : float
The estimated tranfer entropy of x -> y.
tentyx : float
The estimated tranfer entropy of y -> x.
dyconnmap.ts.surrogates module¶
Surrogate Analysis
-
dyconnmap.ts.surrogates.
aaft
(ts, num_surr=1, rng=None)[source]¶ Amplitude Adjusted Fourier Transform
- Parameters
ts : :
num_surr : :
rng : object or None
An object of type numpy.random.RandomState
-
dyconnmap.ts.surrogates.
fdr
(p_values, q=0.01, method='pdep')[source]¶ False Discovery Rate
- Parameters
p_values : :
q : :
method : :
-
dyconnmap.ts.surrogates.
phase_rand
(data, num_surr=1, rng=None)[source]¶ Phase-randomized suggorates
- Parameters
data : :
num_surr : :
rng : object or None
An object of type numpy.random.RandomState
-
dyconnmap.ts.surrogates.
surrogate_analysis
(ts1, ts2, num_surr=1000, estimator_func=None, ts1_no_surr=False, rng=None)[source]¶ Surrogate Analysis
- Parameters
ts1 : :
ts2 : :
num_surr : int
estimator_func : function
ts1_no_surr : boolean
rng : object or None
An object of type numpy.random.RandomState
- Returns
p_val : float
corr_surr : :
surrogates : :
r_value : float
dyconnmap.ts.teager_kaiser_energy module¶
Teager–Kaiser Operator
ref: https://www.c-motion.com/v3dwiki/index.php/Teager_Kaiser_Energy
dyconnmap.ts.wald module¶
Wald test
Module contents¶
-
dyconnmap.ts.
fisher_z
(data)[source]¶ Fisher’s z-transformation
For a given dataset \(p\) bound to \([0.0, 1.0]\), we can use Fisher’s z-transformation to normalize it in an approximately Gaussian distribution.
This transformation is computed as follows:
\[z_p := \frac{1}{2} \text{ln} \left ( \frac{1+p}{1-p} \right ) = \text{arctanh}(p)\]
-
dyconnmap.ts.
fisher_z_plv
(data)[source]¶ - \[z^p_j = sin^{-1}(2 * PLV_j - 1)\]
- Mormann2005
Mormann, F., Fell, J., Axmacher, N., Weber, B., Lehnertz, K., Elger, C. E., & Fernández, G. (2005). Phase/amplitude reset and theta–gamma interaction in the human medial temporal lobe during a continuous word recognition memory task. Hippocampus, 15(7), 890-900.
-
dyconnmap.ts.
sample_entropy
(data, dim=2, tau=None, r=None)[source]¶ Sample Entropy
- Parameters
data : array-like, shape(n_samples)
Symbolic time series.
dim : int
Embedding dimension. Default 2.
tau : int
Delay time for downsampling. Is None, 1 is passed.
r : float
Tolerance factor. If None, 0.2 * std(data) is passed.
- Returns
SampEn : float
Sample entropy.
See also
dyconnmap.ts.embed_ts
Embedded timeseries
-
dyconnmap.ts.
embed_delay
(ts, dim, tau)[source]¶ Embed delay
- Parameters
ts : array-like, shape(n_samples)
One-dimensional symbolic time series.
dim : int
The embedding dimension.
tau : int
Time delay factor.
- Returns
y : array-like
The embedded timeseries.
-
dyconnmap.ts.
aaft
(ts, num_surr=1, rng=None)[source]¶ Amplitude Adjusted Fourier Transform
- Parameters
ts : :
num_surr : :
rng : object or None
An object of type numpy.random.RandomState
-
dyconnmap.ts.
fdr
(p_values, q=0.01, method='pdep')[source]¶ False Discovery Rate
- Parameters
p_values : :
q : :
method : :
-
dyconnmap.ts.
phase_rand
(data, num_surr=1, rng=None)[source]¶ Phase-randomized suggorates
- Parameters
data : :
num_surr : :
rng : object or None
An object of type numpy.random.RandomState
-
dyconnmap.ts.
surrogate_analysis
(ts1, ts2, num_surr=1000, estimator_func=None, ts1_no_surr=False, rng=None)[source]¶ Surrogate Analysis
- Parameters
ts1 : :
ts2 : :
num_surr : int
estimator_func : function
ts1_no_surr : boolean
rng : object or None
An object of type numpy.random.RandomState
- Returns
p_val : float
corr_surr : :
surrogates : :
r_value : float
-
dyconnmap.ts.
entropy_reduction_rate
(sym_ts)[source]¶ Entropy Reduction Rate
- Parameters
sym_ts : array-like, shape(n_samples)
Input symblic time series.
- Returns
entredrate : float
The estimated entropy reduction rate.
-
dyconnmap.ts.
symoblic_transfer_entropy
(x, y, s=1, delay=0, verbose=False)[source]¶ Symbolic Tranfer Entropy
- Parameters
x : array-like, shape(N)
Symblic time series (1D).
y : array-like, shape(N)
Symbolic time series (1D).
s : int
Embedding dimension.
delay : int
Time delay parameter
verbose : boolean
Print computation messages.
- Returns
tent_diff : float
The difference of the tranfer entropies of the two time series.
tentxy : float
The estimated tranfer entropy of x -> y.
tentyx : float
The estimated tranfer entropy of y -> x.
-
dyconnmap.ts.
ordinal_pattern_similarity
(signal1, signal2, m, tau)[source]¶ Ordinal Pattern Similarity
- Parameters
signal1 : :
signal2 : :
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
dissimilarity : float
The dissimilarity index as computed from the ordinal patterns.
ordinal_patterns : array
The time series of ordinal patterns for input signals.
patterns_distribution : array
Distribution of the patterns.
Notes
The results may vary from the original MATLAB script because of the permutations’ order.
The permutations are generated from \([1, dim+1]\) so there are no occurances of \(0.\)
The extra \(+1\) in the lines .. python: I = sklearn.preprocessing.normalize(I + 1) is in order to avoid :math:`0`s.
-
dyconnmap.ts.
permutation_entropy
(signal, m, tau)[source]¶ Permutation Entropy
- Parameters
signal : array-like, shape(N)
Symblic time series (1D).
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
pe : float
Permutation entropy.
npe : float
Normalized permutation entropy.
-
dyconnmap.ts.
ordinal_pattern_similarity
(signal1, signal2, m, tau)[source] Ordinal Pattern Similarity
- Parameters
signal1 : :
signal2 : :
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
dissimilarity : float
The dissimilarity index as computed from the ordinal patterns.
ordinal_patterns : array
The time series of ordinal patterns for input signals.
patterns_distribution : array
Distribution of the patterns.
Notes
The results may vary from the original MATLAB script because of the permutations’ order.
The permutations are generated from \([1, dim+1]\) so there are no occurances of \(0.\)
The extra \(+1\) in the lines .. python: I = sklearn.preprocessing.normalize(I + 1) is in order to avoid :math:`0`s.
-
dyconnmap.ts.
rr_order_patterns
(signal1, signal2, m, tau)[source]¶ - Parameters
signal1 : :
signal2 : :
m : int
Embedding dimension.
tau : int
Time delay parameter.
- Returns
cstr : float
Coupling strength.
Notes
The results may vary from the original MATLAB script because of the permutations’ order.
The results may vary from the original MATLAB script because of the order of the indices in the :python:`numpy.where`.
The permutations are generated from \([1, dim+1]\) so there are no occurances of \(0.\)
The extra \(+1\) in the lines .. python: I = sklearn.preprocessing.normalize(I + 1) is in order to avoid :math:`0`s.
-
dyconnmap.ts.
entropy
(x)[source]¶ Entropy
- Parameters
x : array-like, shape(N)
Input symbolic time series.
- Returns
entropy : float
The computed entropy.
-
dyconnmap.ts.
wald
(x, y)[source]¶ - Parameters
x : :
y : :
- Returns
w : float
r : float
edges : array-like
weights : array-like
Notes
The input time series will be padded with zeros if needed.
-
dyconnmap.ts.
dcorr
(x, y)[source]¶ Distance Correlation
- Parameters
x : array-like, shape(n_samples)
Input time series.
y : array-like, shape(N)
Input time series.
- Returns
val : float
The computed distance correlation.
-
dyconnmap.ts.
markov_matrix
(symts, states_from_length=True)[source]¶ Markov Matrix
Markov matrix (also refered as “transition matrix”) is a square matrix that tabulates the observed transition probabilities between symbols for a finite Markov Chain. It is a first-order descriptor by which the next symbol depends only on the current symbol (and not on the previous ones); a Markov Chain model.
A transition matrix is formally depicted as:
Given the probability \(Pr(j|i)\) of moving between \(i\) and \(j\) elements, the transition matrix is depicted as:
\[\begin{split}P = \begin{pmatrix} P_{1,1} & P_{1,2} & \ldots & P_{1,j} & \ldots & P_{1,S} \\ P_{2,1} & P_{2,2} & \ldots & P_{2,j} & \ldots & P_{2,S} \\ \vdots & \vdots & \ddots & \vdots & \ddots & \vdots \\ P_{i,1} & P_{i,2} & \ldots & P_{i,j} & \ldots & P_{i,S} \\ \vdots & \vdots & \ddots & \vdots & \ddots & \vdots \\ P_{S,1} & P_{S,2} & \ldots & P_{S,j} & \ldots & P_{S,S} \\ \end{pmatrix}\end{split}\]Since the transition matrix is row-normalized, so as the total transition probability from state \(i\) to all the others must be equal to \(1\).
For more properties consult, among other links WolframMathWorld_ and WikipediaMarkovMatrix_.
- WolframMathWorld
- WikipediaMarkovMatrix
- Parameters
symts : array-like, shape(N)
One-dimensional discrete time series.
states_from_length: bool or int, optional :
Used to account symbolic time series in which not all the symbols are present. That may happen when for example the symbols are drawn from different distributions. Default True, the size of the resulting Markov Matrix is equal to the number of unique symbols present in the time series. If False, the size will be the highest symbolic state + 1. You may also speficy the highest (inclusive) symbolic state.
- Returns
mtx : matrix
The transition matrix. The size depends the parameter states_from_length.
-
dyconnmap.ts.
transition_rate
(symts, weight=None)[source]¶ Transition Rate
The total sum of transition between symbols.
- Parameters
symts : :
weight : float
-
dyconnmap.ts.
occupancy_time
(symts, symbol_states=None, weight=None)[source]¶ Occupancy Time
- Parameters
symts : :
symbol_states : int
The maximum number of symbols. This is useful to define in case your symbolic timeseries skips some states, in which case would produce a matrix of different size.
weight : float
The weights of the reuslting transition symbols. Default len(symts).
- Returns
oc : :
symbols : :
-
dyconnmap.ts.
teager_kaiser_energy
(ts)[source]¶ Teager Kaiser Energy
- Parameters
ts : array of size [1 x samples]
-
dyconnmap.ts.
complexity_index
(x, sub_len=-1, normalize=False, iterations=100)[source]¶ Complexity Index
- Parameters
x : array-like, shape(n_samples)
Input symbolic time series.
sub_len : int
Maximum subword length. Default is len(x) - 1.
normalize : bool
Normalize result. Default is False.
iterationss : int
Number of iterations to perform randomization. Default is 100.
- Returns
normal_ci : float
The computed omplexity index after normalization against the randomization procedure.
ci : float
The computed complexity index.
spectrum : array-like
A list of the number of distinct subwords of length 1, up to the size of the input symbolic time series.
-
dyconnmap.ts.
fnn
(ts, tau, max_dim=20, neighbors_reduction=0.1, rtol=15.0, atol=2.0)[source]¶ False Nearest Neighbors
- Parameters
ts : array-like, 1d
tau : int
Time-delay parameter.
max_dim : int
Maximum embedding dimension.
neighbors_reduction : float
Maximum percentage of neighbors reduction. Default ‘0.10’ (10%).
rtol : float
First threshold, criterion to identify a false neighbor. (Neighborhood size)
atol : float
Second threshold, criterion to identify a false neighbor.
- Returns
min_dimension : int
Minimum embedding dimension.
Notes
The execution stops either when the maxium number of embedding dimensions is reached, or the the number of neighbors is reduced to specific percentage.