Skip to content

Unit likelihoods

UnitLogLikelihood holds the log likelihood of each independent unit of a set of responses at each posterior draw, with the unit that each response row belongs to. ModelFit.unit_log_likelihood returns one for each set of responses whose rows share units.

units

Log likelihoods of the independent units of a fit's responses.

UnitLogLikelihood didactic-model

UnitLogLikelihood(*, axes: tuple[str, ...] | None, responses: tuple[str, ...], log_likelihood: Tensor = field(opaque=True, extras=OPAQUE_BY_IDENTITY), row_units: dict[str, Tensor] = field(opaque=True, extras=OPAQUE_BY_IDENTITY))

Bases: ValueModel

The log likelihood of each independent unit of a set of responses.

Given the latents of a draw, the units are independent, so the sum of their log likelihoods is that of all the responses together. Leaving out one unit is the prediction question these scores answer.

PARAMETER DESCRIPTION
axes

The objects that index the units, outermost first. None when the units are the entries of one observation.

TYPE: tuple[str, ...] or None

responses

The responses whose rows the units hold.

TYPE: tuple[str, ...]

log_likelihood

(chains, draws, *units), without likelihood powers. A score with one unit has one entry.

TYPE: Tensor DEFAULT: field(opaque=True, extras=OPAQUE_BY_IDENTITY)

row_units

For each response, the unit of each of its rows, counted row-major over the unit axes.

TYPE: dict[str, Tensor] DEFAULT: field(opaque=True, extras=OPAQUE_BY_IDENTITY)