Bad-channel detection via the Local Outlier Factor (LOF) algorithm. More...


Go to the source code of this file.
Classes | |
| struct | UTILSLIB::LofBadChannelParams |
Namespaces | |
| namespace | FIFFLIB |
| FIFF file I/O, in-memory data structures and high-level readers/writers. | |
| namespace | UTILSLIB |
| Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms). | |
Functions | |
| DSPSHARED_EXPORT QStringList | UTILSLIB::findBadChannelsLof (const Eigen::MatrixXd &data, const FIFFLIB::FiffInfo &info, const LofBadChannelParams ¶ms=LofBadChannelParams()) |
| Detect bad channels using Local Outlier Factor (LOF). | |
| DSPSHARED_EXPORT Eigen::VectorXd | UTILSLIB::computeLofScores (const Eigen::MatrixXd &features, int k) |
| Compute LOF scores for a feature matrix. | |
Bad-channel detection via the Local Outlier Factor (LOF) algorithm.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
LOF (Breunig et al., SIGMOD 2000) scores each channel by the ratio between its own local density (reachability distance to its k nearest channels in the chosen feature space) and the average local density of those neighbours. Values close to 1 indicate a sample that belongs to a dense cluster, values noticeably above 1 mark density outliers. For MEG / EEG each channel is summarised by per-segment statistics (RMS, variance, higher-order moments) so that genuinely flat, very noisy or amplifier- saturated sensors stand out in the LOF score and can be flagged at a single threshold (default 2.0).
The detector follows MNE-Python's mne.preprocessing.find_bad_channels_lof so MEG / EEG pipelines can switch between the two without changing the downstream interpolation / SSS step.
Definition in file bad_channels_lof.h.