metacausal.aggregation.EnsembleWeights

class metacausal.aggregation.EnsembleWeights(weights, model_names, intercept=0.0, method='', details=None)[source]

Bases: object

Result of weight computation for any non-pointwise aggregation.

Variables:
  • weights (numpy.ndarray) – Per-component weights, shape (K,). Sum to 1 for agreement and DR simplex strategies; non-negative for R-Stacking.

  • model_names (list[str]) – Adapter names in the same order as weights.

  • intercept (float) – Constant CATE shift. Nonzero only for R-Stacking.

  • method (str) – Which strategy produced these weights.

  • details (dict | None) – Method-specific metadata (e.g., mean_taus for CBA).

Parameters:

Methods

__init__

plot

Bar chart of these aggregation weights.

Attributes

Details

plot(*, ax=None, on_uniform='warn', sort=True)[source]

Bar chart of these aggregation weights.

Thin wrapper around metacausal.plots.weights(); see there for the full parameter reference. Requires the plots extra (pip install 'metacausal[plots]').

Returns:

matplotlib Axes the plot was drawn on.

Parameters:
  • ax (Axes | None)

  • on_uniform (Literal['warn', 'error', 'ignore'])

  • sort (bool)

Return type:

Axes

details: dict | None = None
intercept: float = 0.0
method: str = ''
model_names: list[str]
weights: ndarray