eegdash.features.feature_bank.dimensionality#
Dimensionality Features Extraction#
This module provides functions to compute various dimensionality features from signals.
Data Shape Convention#
This module follows a Time-Last convention:
Input:
(..., time)Output:
(...,)
All functions collapse the last dimension (time), returning an ndarray of features corresponding to the leading dimensions (e.g., subjects, channels).
Functions
|
Calculate Higuchi's Fractal Dimension (HFD). |
|
Calculate Petrosian Fractal Dimension (PFD). |
|
Calculate Katz Fractal Dimension (KFD). |
|
Estimate the Hurst Exponent. |
|
Calculate the Scaling Exponent via DFA. |
- eegdash.features.feature_bank.dimensionality.dimensionality_higuchi_fractal_dim(x, /, k_max=10, eps=1e-07)[source]
Calculate Higuchi’s Fractal Dimension (HFD).
Higuchi’s Fractal Dimension [1] [2] estimates the complexity of a time series by measuring the mean length of the curve at different time scales $k$. It is highly robust for non-stationary signals.
- Parameters:
x (ndarray) – The input signal.
k_max (int, optional) – Maximum time interval (delay) used for calculating curve lengths.
eps (float, optional) – A small constant to avoid log of zero during regression.
- Returns:
The Higuchi’s Fractal Dimension values. Shape is
x.shape[:-1].- Return type:
ndarray
Notes
Optimized with Numba.
For a theoretical overview of Higuchi’s Fractal Dimension, see the Wikipedia entry.
References
[1]Higuchi, T., 1988. Approach to an irregular time series on the basis of the fractal theory. Physica D: Nonlinear Phenomena, 31(2), pp.277-283.
[2]Esteller, R., Vachtsevanos, G., Echauz, J. and Litt, B., 2001. A comparison of waveform fractal dimension algorithms. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 48(2), pp.177-183.
- eegdash.features.feature_bank.dimensionality.dimensionality_petrosian_fractal_dim(x, /)[source]
Calculate Petrosian Fractal Dimension (PFD).
Petrosian Fractal Dimension [1] [2] provides a fast estimate of fractal dimension by analyzing the number of sign changes in the signal’s first derivative.
- Parameters:
x (ndarray) – The input signal.
- Returns:
The Petrosian Fractal Dimension values. Shape is
x.shape[:-1].- Return type:
ndarray
References
[1]Petrosian, A., 1995. Kolmogorov complexity of finite sequences and recognition of different preictal EEG patterns. In Proceedings of the 1995 IEEE International Symposium on Circuits and Systems (Vol. 2, pp. 86-89). IEEE.
[2]Esteller, R., Vachtsevanos, G., Echauz, J. and Litt, B., 2001. A comparison of waveform fractal dimension algorithms. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 48(2), pp.177-183.
- eegdash.features.feature_bank.dimensionality.dimensionality_katz_fractal_dim(x, /)[source]
Calculate Katz Fractal Dimension (KFD).
Katz Fractal Dimension [1] [2] is calculated as the ratio between the total path length and the maximum planar distance from the first point to any other point.
- Parameters:
x (ndarray) – The input signal.
- Returns:
The Katz Fractal Dimension values. Shape is
x.shape[:-1].- Return type:
ndarray
References
[1]Katz, M. J. (1988). Fractals and the analysis of waveforms. Computers in Biology and Medicine, 18(3), 145-156.
[2]Esteller, R., Vachtsevanos, G., Echauz, J. and Litt, B., 2001. A comparison of waveform fractal dimension algorithms. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 48(2), pp.177-183.
- eegdash.features.feature_bank.dimensionality.dimensionality_hurst_exp(x, /)[source]
Estimate the Hurst Exponent.
The Hurst exponent quantifies the long-term memory and predictability of a time series. It indicates whether a process is purely random, tends to trend in the same direction (persistent), or tends to reverse its direction (anti-persistent).
- Parameters:
x (ndarray) – The input signal.
- Returns:
The estimated Hurst Exponents. Shape is
x.shape[:-1].- Return type:
ndarray
Notes
This function calculate the Gamma Function Ratios and Bias Correction Factors to apply the Anis-Lloyd correction for small sample sizes.
For more details on the Hurst Exponent and R/S analysis, visit the Wikipedia entry.
- eegdash.features.feature_bank.dimensionality.dimensionality_detrended_fluctuation_analysis(x, /)[source]
Calculate the Scaling Exponent via DFA.
Detrended Fluctuation Analysis (DFA) is a method used to detect long-range temporal correlations (LRTC) in non-stationary signals. It is a more robust way to estimate the Hurst exponent when the data is noisy or has shifting trends.
- Parameters:
x (ndarray) – The input signal.
- Returns:
The DFA scaling exponents ($alpha$). Shape is
x.shape[:-1].- Return type:
ndarray
Notes
Optimized with Numba.
For a theoretical overview of Detrended Fluctuation Analysis, see the Wikipedia entry.