mne_rt.combiners.GeometricMeanCombiner#
- class mne_rt.combiners.GeometricMeanCombiner(features: list[str], weights: dict[str, float] | None = None, floor: float | None = None)[source]#
Bases:
FeatureCombinerGeometric mean of (positive) feature values.
Computes the weighted geometric mean:
mixed = exp( Σ(wᵢ · log(max(xᵢ, floor))) / Σ(wᵢ) )
with uniform weights
wᵢ = 1when weights isNone. Input values are clipped to floor before the log transform so that zero or negative inputs do not causeNaNor−inf.Best suited for features that are inherently positive and multiplicative, such as band-power ratios, coherence values, or connectivity measures.
- Parameters:
- features
listofstr Ordered modality names to include.
- weights
dict[str,float] |None, defaultNone Optional per-feature exponents in the weighted geometric mean.
Noneapplies equal weighting (all exponents = 1).- floor
float|None, defaultNone Absolute value each input is clipped to before taking its logarithm.
Noneclips nothing: a non-positive feature (for which the geometric mean is undefined) is dropped from the product instead, and if none survive the result is0.0.Pass a float only if you want the clipping behaviour and know your features’ magnitude. A floor above their real values replaces them — with the pre-1.2.0 default of
1e-9against band power of ~1e-14, every input clipped to the floor and the result was the constant1e-9regardless of the data.Changed in version 1.2.0: Default changed from
1e-9toNone. An explicit float keeps its previous meaning exactly.
- features
Examples
Equal-weight geometric mean of three power features:
from mne_rt.combiners import GeometricMeanCombiner combiner = GeometricMeanCombiner( features=["sensor_power", "band_ratio", "individual_peak_power"] ) mixed = combiner.combine({ "sensor_power": 2.0, "band_ratio": 0.5, "individual_peak_power": 1.0, }) # mixed = (2.0 * 0.5 * 1.0) ** (1/3) ≈ 1.0
Weighted exponents (emphasise sensor_power):
combiner = GeometricMeanCombiner( features=["sensor_power", "band_ratio"], weights={"sensor_power": 2.0, "band_ratio": 1.0}, )
- __init__(features: list[str], weights: dict[str, float] | None = None, floor: float | None = None) None[source]#
Methods