eegdash.features.extractors module#
- class eegdash.features.extractors.BivariateFeature(*args, channel_pair_format: str = '{}<>{}')[source]
Bases:
MultivariateFeature
A feature kind for operations on pairs of channels.
- Parameters:
channel_pair_format (str, default="{}<>{}") – A format string used to create feature names from pairs of channel names.
- feature_channel_names(ch_names: list[str]) list[str] [source]
Generate feature names for each pair of channels.
- static get_pair_iterators(n: int) tuple[ndarray, ndarray] [source]
Get indices for unique, unordered pairs of channels.
- class eegdash.features.extractors.DirectedBivariateFeature(*args, channel_pair_format: str = '{}<>{}')[source]
Bases:
BivariateFeature
A feature kind for directed operations on pairs of channels.
- static get_pair_iterators(n: int) list[ndarray] [source]
Get indices for all ordered pairs of channels (excluding self-pairs).
- class eegdash.features.extractors.FeatureExtractor(feature_extractors: Dict[str, Callable], **preprocess_kwargs: Dict)[source]
Bases:
TrainableFeature
A composite feature extractor that applies multiple feature functions.
This class orchestrates the application of a dictionary of feature extraction functions to input data. It can handle nested extractors, pre-processing, and trainable features.
- Parameters:
feature_extractors (dict[str, callable]) – A dictionary where keys are feature names and values are the feature extraction functions or other FeatureExtractor instances.
**preprocess_kwargs – Keyword arguments to be passed to the preprocess method.
- clear()[source]
Clear the state of all trainable sub-features.
- fit()[source]
Fit all trainable sub-features.
- partial_fit(*x, y=None)[source]
Partially fit all trainable sub-features.
- preprocess(*x, **kwargs)[source]
Apply pre-processing to the input data.
- Parameters:
*x (tuple) – Input data.
**kwargs – Additional keyword arguments.
- Returns:
The pre-processed data.
- Return type:
tuple
- class eegdash.features.extractors.MultivariateFeature[source]
Bases:
object
A mixin for features that operate on multiple channels.
This class provides a __call__ method that converts a feature array into a dictionary with named features, where names are derived from channel names.
- feature_channel_names(ch_names: list[str]) list[str] [source]
Generate feature names based on channel names.
- Parameters:
ch_names (list of str) – The names of the input channels.
- Returns:
The names for the output features.
- Return type:
list of str
- class eegdash.features.extractors.TrainableFeature[source]
Bases:
ABC
Abstract base class for features that require training.
This ABC defines the interface for feature extractors that need to be fitted on data before they can be used. It includes methods for fitting the feature extractor and for resetting its state.
- abstractmethod clear()[source]
Reset the internal state of the feature extractor.
- fit()[source]
Finalize the training of the feature extractor.
This method should be called after all data has been seen via partial_fit. It marks the feature as fitted.
- abstractmethod partial_fit(*x, y=None)[source]
Update the feature extractor’s state with a batch of data.
- Parameters:
*x (tuple) – The input data for fitting.
y (any, optional) – The target data, if required for supervised training.
- class eegdash.features.extractors.UnivariateFeature[source]
Bases:
MultivariateFeature
A feature kind for operations applied to each channel independently.
- feature_channel_names(ch_names: list[str]) list[str] [source]
Return the channel names themselves as feature names.