mne_rt.combiners.GeometricMeanCombiner#

class mne_rt.combiners.GeometricMeanCombiner(features: list[str], weights: dict[str, float] | None = None, floor: float | None = None)[source]#

Bases: FeatureCombiner

Geometric mean of (positive) feature values.

Computes the weighted geometric mean:

mixed = exp( Σ(wᵢ · log(max(xᵢ, floor))) / Σ(wᵢ) )

with uniform weights wᵢ = 1 when weights is None. Input values are clipped to floor before the log transform so that zero or negative inputs do not cause NaN or −inf.

Best suited for features that are inherently positive and multiplicative, such as band-power ratios, coherence values, or connectivity measures.

Parameters:
featureslist of str

Ordered modality names to include.

weightsdict[str, float] | None, default None

Optional per-feature exponents in the weighted geometric mean. None applies equal weighting (all exponents = 1).

floorfloat | None, default None

Absolute value each input is clipped to before taking its logarithm. None clips nothing: a non-positive feature (for which the geometric mean is undefined) is dropped from the product instead, and if none survive the result is 0.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-9 against band power of ~1e-14, every input clipped to the floor and the result was the constant 1e-9 regardless of the data.

Changed in version 1.2.0: Default changed from 1e-9 to None. An explicit float keeps its previous meaning exactly.

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

__init__(features[, weights, floor])

combine(values)

Return the weighted geometric mean of available feature values.

combine(values: dict[str, float]) float[source]#

Return the weighted geometric mean of available feature values.