metacausal.aggregation.Median

class metacausal.aggregation.Median[source]

Bases: PointwiseStrategy

Pointwise median aggregation.

Default aggregation strategy. 50% breakdown point: the ensemble is unaffected by up to half the component models producing wildly wrong estimates.

Examples

Four component CATE predictions for two evaluation points; the first point has one wild outlier (90.0) that the median ignores:

>>> import numpy as np
>>> from metacausal.aggregation import Median
>>> values = np.array([[10.0, 5.0], [11.0, 5.0], [12.0, 5.0], [90.0, 5.0]])
>>> Median().aggregate(values)
array([11.5,  5. ])

Methods

__init__

aggregate

Reduce a (K, n) component-CATE matrix to a (n,) ensemble CATE.

Attributes

ensemble_weights

Ensemble weights, if applicable.

strategy_family

Details

aggregate(values)[source]

Reduce a (K, n) component-CATE matrix to a (n,) ensemble CATE.

K is the number of component models; n is the number of evaluation points. Subclasses define the per-family rule (pointwise statistical reduction, weighted combination, learned linear combination, etc.).

PointwiseStrategy extends this contract to also accept (K,) 1-D input (returning a 0-d scalar) for the component-ATE aggregation path; see its class docstring. Other families do not meaningfully support 1-D input.

Parameters:

values (ndarray)

Return type:

ndarray