mean_tightness_score#

pymc_marketing.mmm.utility.mean_tightness_score(alpha=0.5, confidence_level=0.75)[source]#

Calculate the Mean Tightness Score (MTS).

MTS balances the posterior mean against a symmetric, quantile-based tail spread and returns a dimensionless, normalized score:

\[\mathrm{MTS}(X; \alpha, p) = 1 - \alpha \frac{T_p(X)}{\mu}\]
where:
  • \(\mu\) is the posterior mean of the samples.

  • \(T_p(X) = |Q_p - \mu| + |\mu - Q_{1-p}|\) is a symmetric tail distance.

Larger \(T_p\) indicates a more dispersed posterior and thus a lower score.

This formulation makes the following properties explicit:
  • \(\alpha\) controls risk aversion: increasing \(\alpha\) increases the penalty on dispersion, so the score decreases for more spread posteriors (all else equal).

  • With \(\alpha = 0\), the score is identically 1 for any samples (no preference signal).

  • For fixed \(X\) and \(p\), the score is linear and non-increasing in \(\alpha\).

  • For fixed \(X\) and \(\alpha\), the score is non-increasing in \(p\) (since \(Q_p - Q_{1-p}\) widens as \(p\) moves away from 0.5).

Parameters:
alphafloat, optional

Risk-aversion weight. Larger values increase the penalty from tail spread (default 0.5).

confidence_levelfloat, optional

Quantile probability \(p \in (0, 1)\) used to compute \(T_p\). Typical choices are \(p \in [0.6, 0.9]\) (default 0.75).

Returns:
UtilityFunctionType

A function that calculates the normalized mean tightness score given samples and budgets.

Raises:
ValueError

If confidence_level is not between 0 and 1.