nnsa.feature_extraction.feature_sets package
Submodules
nnsa.feature_extraction.feature_sets.base module
Classes:
|
High-level interface for processing features sets with multiple features, channels, segments. |
- class nnsa.feature_extraction.feature_sets.base.FeatureSetResult(features, feature_labels, algorithm_parameters, channel_labels=None, data_info=None, segment_start_times=None, segment_end_times=None, fs=None)[source]
Bases:
ResultBaseHigh-level interface for processing features sets with multiple features, channels, segments.
- Parameters:
features (np.ndarray) – 3D array with feature values per channel per segment (segments, channels, features).
feature_labels (list) – list with labels of the features, corresponding to the rows of features.
algorithm_parameters (nnsa.Parameters) – see ResultBase.
channel_labels (list of str, optional) – labels of the channels corresponding to the second axis in features. If None, default labels will be created. Default is None.
data_info (str, optional) – see ResultBase.
segment_start_times (np.ndarray, optional) – see ResultBase.
segment_end_times (np.ndarray, optional) – see ResultBase.
fs (flaot, optional) – see ResultBase.
Attributes:
Return the number of segments.
- property num_segments
Return the number of segments.
- Returns:
(int) – number of segments.
nnsa.feature_extraction.feature_sets.eeg module
Functions to extract a set of time and frequency features from an EEG signal.
Author: Tim Hermans (tim-hermans@hotmail.com).
Functions:
|
Compute (absolute) features with specific segment length. |
|
Compute time domain features (own set). |
|
Compute time- and frequency-domain features from Stevenson et al. 2014 paper + own set ('S1'). |
- nnsa.feature_extraction.feature_sets.eeg.compute_features(x, fs, window, which='S2', stepsize=None, chunk_size=None, verbose=1)[source]
Compute (absolute) features with specific segment length.
Implemented by segmenting (a chunk of) x and computing the features on the 3d array with segments, making it potentially 2-3x faster than compute_features() which loops over segments, especially when window is not much larger than stepsize.
- Parameters:
x (np.ndarray) – array with shape (n_samples, n_channels).
fs (flaot) – sampling frequency of x in Hz.
window (float) – window length for feature computation (in seconds).
which (str) – which feature set to compute. Choose from: ‘S1’, ‘S2’. See e.g. compute_features_S1() what features are included in S1`.
stepsize (float) – stepsize for feature computation (in seconds). If None, uses window (i.e., no overlap).
chunk_size (int) – number of time samples to process at once. If None, a suitable chunk_size is chosen automatically.
verbose (int) – verbosity level.
- Returns:
features (np.ndarray) – array with shape (n_feat, n_chan, n_seg) containing the features.
feature_labels (list) – list with length n_feat containing feature labels for features.
- nnsa.feature_extraction.feature_sets.eeg.compute_features_S1(x, fs, axis=0)[source]
Compute time domain features (own set).
- Parameters:
x (np.ndarray) – signal array for which to compute features with shape.
fs (float) – sampling frequency of the signal (Hz).
axis (int) – time axis of x (axis along which to compute the features).
- Returns:
features (np.ndarray) – array with length n_features containing the features. Is an N-D array if x is N-D, e.g. if x.shape == (n_segments, n_time, n_channels), then features.shape = (n_features, n_segments, n_channels). Note that the time dimension disappears and that the features are always the first dimension.
feature_labels (list) – list with length n_features containing names for the features.
- nnsa.feature_extraction.feature_sets.eeg.compute_features_S2(x, fs, axis=0)[source]
Compute time- and frequency-domain features from Stevenson et al. 2014 paper + own set (‘S1’).
References
N. J. Stevenson, J. M. O. I. Korotchikova, and G. B. Boylan, “Artefact detection in neonatal EEG,” in 2014 36th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, 2014, doi: 10.1109/embc.2014.6943743.
For IWMF and IWBW: B. R. Greene, S. Faul, W. P. Marnane, G. Lightbody, I. Korotchikova, and G. B. Boylan, “A comparison of quantitative EEG features for neonatal seizure detection,” Clinical Neurophysiology, vol. 119, no. 6, pp. 1248–1261, Jun. 2008, doi: 10.1016/j.clinph.2008.02.001.
- Parameters:
x (np.ndarray) – signal array for which to compute features with shape.
fs (float) – sampling frequency of the signal (Hz).
axis (int) – time axis of x (axis along which to compute the features).
- Returns:
features (np.ndarray) – array with length n_features containing the features. Is an N-D array if x is N-D, e.g. if x.shape == (n_segments, n_time, n_channels), then features.shape = (n_features, n_segments, n_channels). Note that the time dimension disappears and that the features are always the first dimension.
feature_labels (list) – list with length n_features containing names for the features.