API ReferenceΒΆ

The unit_averaging package has two principal modules:

For convenience, all public classes and functions from both modules are exposed at the package level, and you can import everything directly from the package without referencing individual modules:

from unit_averaging import OptimalUnitAverager

Averager classes:

Class

Description

BaseUnitAverager

Abstract base class. Subclass and implement _compute_weights() for custom strategies.

IndividualUnitAverager

Assigns all weight to the target unit (weights = [0, ..., 1, ..., 0]).

MeanGroupUnitAverager

Equal weights for all units (weights = [1/N, ..., 1/N]).

OptimalUnitAverager

MSE-optimal weights (agnostic and with prior restrictions).

SteinUnitAverager

MSE-optimal shrinkage towards mean group estimator.

Focus function classes:

Class

Description

BaseFocusFunction

Abstract base class. Subclass and implement focus_function() and gradient().

InlineFocusFunction

Convenience class for creating focus functions from callables.

IdentityFocusFunction

Convenience class for creating an identity focus function for when the estimates are already the focus parameters.

See also

In addition to this API reference, also see: