ModelCombinationSelection#

class cultivars.bayes.combination.ModelCombinationSelection(*, names, weights, method, scores, results, n_origins=0, notes=())[source]#

Weights over models and the mixture predictive they imply.

The record behind both routes to a combination: posterior model probabilities from marginal likelihoods (Bayesian model averaging) and log-score-optimal weights from held-out predictive densities (stacking). Whatever produced the weights, prediction is the same act – draw a model in proportion to its weight, then one of its predictive paths – so the two share this object and differ only in method and in what scores holds.

Variables:
  • names (tuple[str, ...]) – Model labels, in weight order.

  • weights (NDArray[double]) – (M,) non-negative weights summing to one.

  • method (str) – "bayesian model average" or "stacking".

  • scores (NDArray[double]) – (M,) the per-model number the weights came from – log marginal likelihoods for averaging, mean held-out log predictive densities for stacking.

  • results (tuple[PredictiveResult, ...]) – The fitted results, each exposing forecast_paths.

  • n_origins (int) – Evaluation origins behind stacking weights; 0 for averaging.

  • notes (tuple[str, ...]) – Caveats that qualify the weights.

See also

Attributes#

names

Model labels, aligned with weights, scores, and results.

weights

Non-negative model weights summing to one, (M,).

method

How the weights were formed, "bayesian model average" or "stacking".

scores

The per-model number the weights came from, (M,).

results

The fitted results, each exposing forecast_paths.

n_origins

Evaluation origins behind stacking weights; 0 for averaging.

notes

Caveats that qualify the weights, shown under the summary table.

n_models

Models combined.

Methods#

forecast([steps, n_draws, seed])

The mixture predictive's (16th percentile, mean, 84th percentile).

forecast_paths([steps, n_draws, seed])

Draws from the mixture predictive, one model per draw.

summary()

Weights and the number each came from, heaviest first.