mne_rt.combiners.GeometricMeanCombiner#

class mne_rt.combiners.GeometricMeanCombiner(features: list[str], weights: dict[str, float] | None = None, floor: float = 1e-09)[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, default 1e-9

Minimum value each input is clipped to before log.

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 = 1e-09) 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.