Feature Package Overview#
The eegdash.features namespace re-exports feature extractors,
decorators, and dataset utilities from the underlying submodules so callers can
import the most common helpers from a single place. To avoid duplicated
documentation in the API reference, the classes themselves are documented in
their defining modules (see the links below). This page focuses on the
high-level orchestration helpers that only live in the package __init__.
High-level discovery helpers#
- eegdash.features.get_all_features() list[tuple[str, Callable]][source]#
Get a list of all available feature functions.
Scans the eegdash.features.feature_bank module for functions that have been decorated to have a feature_kind attribute.
- Returns:
A list of (name, function) tuples for all discovered features.
- Return type:
list[tuple[str, callable]]
- eegdash.features.get_feature_kind(feature: Callable) MultivariateFeature[source]#
Get the ‘kind’ of a feature function.
The feature kind (e.g., univariate, bivariate) is typically attached by a decorator.
- Parameters:
feature (callable) – The feature function to inspect.
- Returns:
An instance of the feature kind (e.g.,
UnivariateFeature()).- Return type:
- eegdash.features.get_feature_predecessors(feature_or_extractor: Callable | None) list[source]#
Get the dependency hierarchy for a feature or feature extractor.
This function recursively traverses the parent_extractor_type attribute of a feature or extractor to build a list representing its dependency lineage.
- Parameters:
feature_or_extractor (callable) – The feature function or
FeatureExtractorclass to inspect.- Returns:
A nested list representing the dependency tree. For a simple linear chain, this will be a flat list from the specific feature up to the base
FeatureExtractor. For multiple dependencies, it will contain tuples of sub-dependencies.- Return type:
list
- eegdash.features.get_all_feature_extractors() list[tuple[str, Callable]][source]#
Get a list of all available feature extractor callables.
A feature extractor is any callable in the feature bank that participates in the feature graph, meaning it declares a
parent_extractor_typeviaFeaturePredecessor. This includes both preprocessors and the final feature functions.- Returns:
A list of (name, callable) tuples for all discovered feature extractors.
- Return type:
list[tuple[str, callable]]
- eegdash.features.get_all_feature_kinds() list[tuple[str, type[MultivariateFeature]]][source]#
Get a list of all available feature ‘kind’ classes.
Scans the eegdash.features.extractors module for all classes that subclass
MultivariateFeature.- Returns:
A list of (name, class) tuples for all discovered feature kinds.
- Return type:
list[tuple[str, type[eegdash.features.extractors.MultivariateFeature]]]
Dataset and extraction utilities#
- eegdash.features.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
FeatureExtractorinstance, 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.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:
- eegdash.features.load_features_concat_dataset(path: str | Path, ids_to_load: list[int] | None = None, n_jobs: int = 1) eegdash.features.datasets.FeaturesConcatDataset[source]#
Load a stored
FeaturesConcatDatasetfrom a directory.This function reconstructs a
FeaturesConcatDatasetby loading individualFeaturesDatasetinstances from subdirectories within the given path. It uses joblib for parallel loading.- Parameters:
path (str or pathlib.Path) – The path to the directory where the dataset was saved. This directory should contain subdirectories (e.g., “0”, “1”, “2”, …) for each individual dataset.
ids_to_load (list of int, optional) – A list of specific dataset IDs (subdirectory names) to load. If None, all subdirectories in the path will be loaded.
n_jobs (int, default 1) – The number of jobs to use for parallel loading. -1 means using all processors.
- Returns:
A concatenated dataset containing the loaded
FeaturesDatasetinstances.- Return type:
See also#
eegdash.features.extractorsfor the feature-extraction base classes such asFeatureExtractor.eegdash.features.datasetsfor dataset wrappers likeFeaturesConcatDataset.eegdash.features.feature_bank.*for the concrete feature families (complexity, connectivity, spectral, and more).