meegkit.lof#
Local Outlier Factor (LOF).
Functions
|
Local Outlier Factor. |
- class meegkit.lof.LOF(n_neighbors=20, metric='euclidean', threshold=1.5, **kwargs)#
Bases:
object
Local Outlier Factor.
Local Outlier Factor (LOF) is an automatic, density-based outlier detection algorithm based on [1] and [2].
- Parameters:
n_neighbours (int) – Number of neighbours defining the local neighbourhood.
metric (str in {'euclidean', 'nan_euclidean', 'cosine',) – ‘cityblock’, ‘manhattan’} Metric to use for distance computation. Default is “euclidean”
threshold (float) – Threshold to define outliers. Theoretical threshold ranges anywhere between 1.0 and any integer. Default: 1.5
Notes
It is recommended to perform a CV (e.g., 10-fold) on training set to calibrate this parameter for the given M/EEG dataset.
See [2] for details.
References
[1]Breunig M, Kriegel HP, Ng RT, Sander J. 2000. LOF: identifying density-based local outliers. SIGMOD Rec. 29, 2, 93-104. https://doi.org/10.1145/335191.335388
- __init__(n_neighbors=20, metric='euclidean', threshold=1.5, **kwargs)#
- predict(X)#
Detect bad channels using Local Outlier Factor algorithm.
- Parameters:
X (array, shape=(n_channels, n_samples)) – The data X should have been high-pass filtered.
- Returns:
bad_channel_indices
- Return type:
Detected bad channel indices.