mne.preprocessing.find_bad_channels_lof#
- mne.preprocessing.find_bad_channels_lof(raw, n_neighbors=20, *, picks=None, metric='euclidean', threshold=1.5, return_scores=False, verbose=None)[source]#
Find bad channels using Local Outlier Factor (LOF) algorithm.
- Parameters:
- rawinstance of
Raw
Raw data to process.
- n_neighbors
int
Number of neighbors defining the local neighborhood (default is 20). Smaller values will lead to higher LOF scores.
- picks
str
| array_like |slice
|None
Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g.,
['meg', 'eeg']
) will pick channels of those types, channel name strings (e.g.,['MEG0111', 'MEG2623']
will pick the given channels. Can also be the string values'all'
to pick all channels, or'data'
to pick data channels. None (default) will pick good data channels. Note that channels ininfo['bads']
will be included if their names or indices are explicitly provided.- metric
str
Metric to use for distance computation. Default is “euclidean”, see
sklearn.metrics.pairwise.distance_metrics()
for details.- threshold
float
Threshold to define outliers. Theoretical threshold ranges anywhere between 1.0 and any positive integer. Default: 1.5 It is recommended to consider this as an hyperparameter to optimize.
- return_scoresbool
If
True
, return a dictionary with LOF scores for each evaluated channel. Default isFalse
.- verbosebool |
str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- rawinstance of
- Returns:
See also
Notes
See [1] and [2] for background on choosing
threshold
.New in v1.7.
References