kumulant

Companion

Empirical-Bayes / hierarchical helpers that operate on populations of fitted snapshots.

Functions

fitPopulationPrior

fun fitPopulationPrior(snapshots: List<CovarianceRegressionResult>, weight: (CovarianceRegressionResult) -> Double = { it.totalWeights.coerceAtLeast(1.0) }): PopulationPrior(source)

Empirical-Bayes population prior from a set of per-instance posteriors that share the same feature layout. Decomposes total variance into within-instance (mean of per-instance covariances) plus between-instance (covariance of per-instance means):

mu_pop    = weighted_mean(snapshot_i.weights)
Sigma_pop = mean(snapshot_i.covariance)
          + weighted_cov(snapshot_i.weights, mu_pop)

Weighting per snapshot is snapshot.totalWeights by default (more data = tighter contribution); pass an explicit weight selector to override (e.g. uniform weighting, or weighting by step). Empty input throws.