actual_expected#

SuperLSS.actual_expected(
X: object | EagerFrame,
y: NDArray,
covariate: str | NDArray,
*,
name: str | None = None,
sample_weight: NDArray | None = None,
offsets: Mapping[str, NDArray] | None = None,
**kwargs: Any,
) → ActualExpected#

Return the realised against the predicted total per bin of a covariate.

Every number in the table is a ratio of weighted sums – sum w y over sum w mu_hat – so on a rate target with exposure weights it reads as total cost over total expected cost, never as the mean of per-row ratios. sample_weight is that aggregation weight, and it also fixes the standard error’s law: prior weights put the weight inside each row’s distribution, frequency weights replicate the row.