mne_hfo.RMSDetector¶
-
class
mne_hfo.
RMSDetector
(threshold=3, win_size=100, overlap=0.25, sfreq=None, filter_band=(100, 500), scoring_func='f1', n_jobs=- 1, hfo_name='hfo', verbose=False)[source]¶ Root mean square (RMS) detection algorithm (Staba Detector).
The original algorithm described in the reference, takes a sliding window of 3 ms, computes the RMS values between 100 and 500 Hz. Then events separated by less than 10 ms were combined into one event. Then events not having a minimum of 6 peaks (i.e. band-pass signal rectified above 0 V) with greater then 3 std above mean baseline were removed. A finite impulse response (FIR) filter with a Hamming window was used.
- Parameters
filter_band : tuple(float, float) | None
Low cut-off frequency at index 0 and high cut-off frequency at index 1.
threshold: float
Number of standard deviations to use as a threshold. Default = 3.
win_size: int
Sliding window size in samples. Default = 100. The original paper uses a window size equivalent to 3 ms.
overlap: float
Fraction of the window overlap (0 to 1). Default = 0.25. The original paper uses an overlap of 0.
offset: int
Offset which is added to the final detection. This is used when the function is run in separate windows. Default = 0
References
[1] R. J. Staba, C. L. Wilson, A. Bragin, I. Fried, and J. Engel, “Quantitative Analysis of High-Frequency Oscillations (80 − 500 Hz) Recorded in Human Epileptic Hippocampus and Entorhinal Cortex,” J. Neurophysiol., vol. 88, pp. 1743–1752, 2002.
- Attributes
-
Return dictionary of HFO start/end points.
Return list of HFO start/end points for each channel.
Higher frequency band for HFO definition.
Return HFO detections as a dataframe.
HFO event array.
Return HFO detections as an event.tsv DataFrame.
Lower frequency band for HFO definition.
Step size of each window.
Methods
fit
(X[, y])Fit the model according to the optionally given training data.
fit_predict
(X[, y])Perform fit on X and returns labels for X.
get_params
([deep])Get parameters for this estimator.
predict
(X)Scikit-learn override predict function.
score
(X, y[, sample_weight])Return the score of the HFO prediction.
set_params
(**params)Set the parameters of this estimator.
-
property
chs_hfos_dict
¶ Return dictionary of HFO start/end points.
-
property
chs_hfos_list
¶ Return list of HFO start/end points for each channel.
-
fit
(X, y=None)¶ Fit the model according to the optionally given training data.
- Parameters
X : mne.io.Raw of shape (n_samples, n_features) | pd.DataFrame
Training vector, where n_samples is the number of samples and n_features is the number of features. In MNE-HFO, n_features are the number of time points in the EEG data, and n_samples are the number of channels.
y : array-like of shape (n_samples, n_output)
Target vector relative to X.
- Returns
self
Fitted estimator.
Notes
All detectors use a sliding window to compute HFOs in windows.
-
fit_predict
(X, y=None)¶ Perform fit on X and returns labels for X.
Returns -1 for outliers and 1 for inliers.
- Parameters
- X{array-like, sparse matrix, dataframe} of shape (n_samples, n_features)
y : Ignored
Not used, present for API consistency by convention.
- Returns
y : ndarray of shape (n_samples,)
1 for inliers, -1 for outliers.
-
get_params
(deep=True)¶ Get parameters for this estimator.
- Parameters
deep : bool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params : dict
Parameter names mapped to their values.
-
property
h_freq
¶ Higher frequency band for HFO definition.
-
property
hfo_df
¶ Return HFO detections as a dataframe.
-
property
hfo_event_arr
¶ HFO event array.
- Returns
hfo_event_arr : np.ndarray
Array that is (n_chs, n_samples), which has a value of
1
if
-
property
hfo_event_df
¶ Return HFO detections as an event.tsv DataFrame.
-
property
l_freq
¶ Lower frequency band for HFO definition.
-
predict
(X)¶ Scikit-learn override predict function.
Just directly computes HFOs using
fit
function.- Parameters
X : mne.io.Raw | pd.DataFrame
Input data.
- Returns
ypred : list[list[tuple]]
List of HFO events per channel in order of
ch_names
of input data. HFO events are stored as list of tuples: onset and offset of the HFO event.
-
score
(X, y, sample_weight=None)¶ Return the score of the HFO prediction.
- Parameters
X : np.ndarray
Channel data to detect HFOs on.
y : pd.DataFrame
Event Dataframe of true labels
- sample_weight :
- Returns
- float
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters
**params : dict
Estimator parameters.
- Returns
self : estimator instance
Estimator instance.
-
property
step_size
¶ Step size of each window.
Window increment over the samples of signal.