Shrinkage and support weights¶
The support weight decides how much of a contribution counts as information. It is the posterior weight an empirical-Bayes observer puts on a fitted bin value versus the population prior of 0 (terms are centered):
where \(v\) is the bin's sampling variance (from bag disagreement) and \(\tau^2\) is the between-bin signal variance of the term. A bin fitted on thousands of rows has \(v \ll \tau^2\) and \(w \approx 1\) — its contribution is information; a bin pinned by a handful of rows has \(w \approx 0\) — its contribution is mostly the model guessing, and lands in D.
Estimating τ²¶
estimate_tau2 supports two methods per term:
"mom"(default) — mass-weighted method of moments: \(\hat\tau^2 = \max\bigl(0,\ \sum_b \pi_b f_b^2 - \sum_b \pi_b v_b\bigr)\), where \(\pi_b\) is the bin's share of training mass."mle"— 1-D marginal maximum likelihood, more stable for high-cardinality terms.
\(\hat\tau^2 = 0\) identifies a pure-noise feature: the term's entire contribution is routed to D, and a warning is logged.
Two adjustments to w¶
- Empty bins: a bin with zero training mass gets \(w = 0\) regardless of its nominal variance — an unseen region is never counted as information.
- Out-of-range decay (exact mode only): instances outside the feature's
training range have their weight decayed by
\(\exp(-\lambda \cdot \text{dist}/\text{IQR})\) and are flagged
oov. Approximate mode emits theoovflag but applies no decay — bag disagreement already rises in sparse regions (decision 3).
The audit payload¶
TriadExplainer.shrinkage exposes the per-term shrinkage parameters as a frame —
the audit payload of spec §4.4:
| Column | Meaning |
|---|---|
tau2 |
between-bin signal variance \(\hat\tau^2\) |
sigma2 |
mass-weighted average noise \(\sum_b \pi_b\, n_b v_b\) |
k |
count-form shrinkage strength \(\sigma^2 / \tau^2\) (inf for pure-noise terms) |
Together with the per-feature w column already present in the channels frame,
this documents exactly how much every contribution was shrunk. In approximate mode
the frame instead reports the per-feature \(\hat\tau^2\).
Stability note¶
Per-instance variance from K = 8 replicas is a \(\chi^2_7\)-noisy estimate; \(\hat\tau^2\),
which averages \(v\) over the reference population, stays stable. n_bags is
configurable in fit_lgbm_gam and fit_bagged (decision 7).