find_bad_channels_lof¶
Find bad channels using Local Outlier Factor (LOF) algorithm.
- Parameters:
raw (
instanceofRaw) – 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_good_data)s
metric (
str) – Metric to use for distance computation. Default is “euclidean”, seesklearn.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_scores (
bool) – IfTrue, return a dictionary with LOF scores for each evaluated channel. Default isFalse.%(verbose)s
- Returns:
noisy_chs (
list) – List of bad M/EEG channels that were automatically detected.scores (
ndarray,shape (n_picks,)) – Only returned whenreturn_scoresisTrue. It contains the LOF outlier score for each channel inpicks.
See also
maxwell_filter,annotate_amplitudeNotes
See :footcite:`KumaravelEtAl2022` and :footcite:`BreunigEtAl2000` for background on choosing
threshold.Added in version 1.7.
References