mne_rt.combiners.ZScoredNormCombiner#
- class mne_rt.combiners.ZScoredNormCombiner(features: list[str], warmup: int = 30)[source]#
Bases:
FeatureCombinerEuclidean norm after online z-score normalisation of each feature.
Each feature stream is independently normalised using the mean and standard deviation estimated from the first warmup windows:
zᵢ = (xᵢ − μᵢ) / σᵢ mixed = ‖z‖ / √n = sqrt(Σ zᵢ²) / sqrt(n)
Dividing by
√nkeeps the output near 1 when all features hover at their baseline mean, and it grows when any feature deviates — making it a natural “how different from baseline are we?” score.Statistics are frozen after warmup (no drift tracking). To re-fit (e.g. between blocks), call
reset().- Parameters:
Notes
If a feature’s standard deviation is effectively zero (constant signal), it is floored at
1e-9to prevent division-by-zero.Examples
from mne_rt.combiners import ZScoredNormCombiner combiner = ZScoredNormCombiner( features=["sensor_power", "laterality", "connectivity_ratio"], warmup=30, ) for window_vals in session_data: # first 30 calls return 0.0 mixed = combiner.combine(window_vals)
Methods
__init__(features[, warmup])combine(values)Return the z-scored Euclidean norm, or
0.0during warmup.reset()Clear collected statistics and restart the warmup phase.