autoreject.AutoReject

class autoreject.AutoReject(n_interpolate=None, consensus=None, thresh_func=None, cv=10, picks=None, thresh_method='bayesian_optimization', n_jobs=1, random_state=None, verbose='progressbar')[source]

Efficiently find n_interpolate and consensus.

Note

AutoReject by design supports multiple channels. If no picks are passed, separate solutions will be computed for each channel type and internally combined. This then readily supports cleaning unseen epochs from the different channel types used during fit.

Parameters
consensusarray | None

The values to try for percentage of channels that must agree as a fraction of the total number of channels. This sets \(\\kappa/Q\). If None, defaults to np.linspace(0, 1.0, 11)

n_interpolatearray | None

The values to try for the number of channels for which to interpolate. This is \(\\rho\). If None, defaults to np.array([1, 4, 32])

cva scikit-learn cross-validation object

Defaults to cv=10

picksndarray, shape(n_channels) | None

The channels to be considered for autoreject. If None, defaults to data channels {‘meg’, ‘eeg’}, which will lead fitting and combining autoreject solutions across these channel types. Note that, if picks is None, autoreject ignores channels marked bad in epochs.info[‘bads’].

thresh_methodstr

‘bayesian_optimization’ or ‘random_search’

n_jobsint

The number of jobs.

random_stateint seed, RandomState instance, or None (default)

The seed of the pseudo random number generator to use.

verbose‘tqdm’, ‘tqdm_notebook’, ‘progressbar’ or False

The verbosity of progress messages. If ‘progressbar’, use mne.utils.ProgressBar. If ‘tqdm’, use tqdm.tqdm. If ‘tqdm_notebook’, use tqdm.tqdm_notebook. If False, suppress all output messages.

Attributes
local_reject_list

The instances of _AutoReject for each channel type.

threshes_dict

The sensor-level thresholds with channel names as keys and the peak-to-peak thresholds as the values.

loss_dict of array, shape (len(n_interpolate), len(consensus))

The cross validation error for different parameter values.

consensus_dict

The estimated consensus per channel type.

n_interpolate_dict

The estimated n_interpolate per channel type.

picks_array-like, shape (n_data_channels,)

The data channels considered by autoreject. By default only data channels, not already marked as bads are considered.

Methods

fit(self, epochs)

Fit the epochs on the AutoReject object.

fit_transform(self, epochs[, return_log])

Estimate the rejection params and finds bad epochs.

get_reject_log(self, epochs[, picks])

Get rejection logs of epochs.

save(self, fname[, overwrite])

Save autoreject object.

transform(self, epochs[, return_log])

Remove bad epochs, repairs sensors and returns clean epochs.

__init__(self, n_interpolate=None, consensus=None, thresh_func=None, cv=10, picks=None, thresh_method='bayesian_optimization', n_jobs=1, random_state=None, verbose='progressbar')[source]

Init it.

Methods

__init__(self[, n_interpolate, consensus, …])

Init it.

fit(self, epochs)

Fit the epochs on the AutoReject object.

fit_transform(self, epochs[, return_log])

Estimate the rejection params and finds bad epochs.

get_reject_log(self, epochs[, picks])

Get rejection logs of epochs.

save(self, fname[, overwrite])

Save autoreject object.

transform(self, epochs[, return_log])

Remove bad epochs, repairs sensors and returns clean epochs.

Fork me on GitHub