Skip to content

User-defined feature functions made easy #38

@jbschiratti

Description

@jbschiratti
  1. I think that _embed, _filt, _wavelet_coefs (in utils.py) should not be private functions and should be added (along with power_spectrum) to MNE-features' API. The reason for that is that those functions are "building blocks" for user-defined feature functions. For instance, it would be great if they could do:
from mne_features.utils import power_spectrum
from mne_features.feature_extraction import extract_features

def myspectralfeature(sfreq, data):
    psd, _ = power_spectrum(sfreq, data)
    ...
    return ...

selected_funcs = ['mean', 'variance', ('myfunc', myspectralfeature)]
features = extract_features(epochs_data, sfreq, selected_funcs)
  1. It is implicit that, for any feature function, if sfreq is one of the parameters, then it should be placed first because unless feature_funcs[alias] = partial(func, sfreq) (in _get_feature_funcs) will not work as expected. This should be mentioned in the doc... Or partial(func, sfreq) should be changed for partial(func, **{'sfreq': sfreq}).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions