eegdash.features.utils#
Functions
|
Extract features from a concatenated dataset of windows. |
|
Fit trainable feature extractors on a dataset. |
- eegdash.features.utils.extract_features(concat_dataset: BaseConcatDataset, features: FeatureExtractor | Dict[str, Callable] | List[Callable], *, batch_size: int = 512, n_jobs: int = 1) FeaturesConcatDataset [source]#
Extract features from a concatenated dataset of windows.
This function applies a feature extractor to each WindowsDataset within a BaseConcatDataset in parallel and returns a FeaturesConcatDataset with the results.
- Parameters:
concat_dataset (BaseConcatDataset) – A concatenated dataset of WindowsDataset or EEGWindowsDataset instances.
features (FeatureExtractor or dict or list) – The feature extractor(s) to apply. Can be a FeatureExtractor instance, a dictionary of named feature functions, or a list of feature functions.
batch_size (int, default 512) – The size of batches to use for feature extraction.
n_jobs (int, default 1) – The number of parallel jobs to use for extracting features from the datasets.
- Returns:
A new concatenated dataset containing the extracted features.
- Return type:
- eegdash.features.utils.fit_feature_extractors(concat_dataset: BaseConcatDataset, features: FeatureExtractor | Dict[str, Callable] | List[Callable], batch_size: int = 8192) FeatureExtractor [source]#
Fit trainable feature extractors on a dataset.
If the provided feature extractor (or any of its sub-extractors) is trainable (i.e., subclasses TrainableFeature), this function iterates through the dataset to fit it.
- Parameters:
concat_dataset (BaseConcatDataset) – The dataset to use for fitting the feature extractors.
features (FeatureExtractor or dict or list) – The feature extractor(s) to fit.
batch_size (int, default 8192) – The batch size to use when iterating through the dataset for fitting.
- Returns:
The fitted feature extractor.
- Return type: