multinomial_test#
- scio.scores.utils.multinomial_test(counts, prior, mode)[source]#
Prepare test after having observed counts, with prior belief.
- Parameters:
counts (
Tensor) – Observed counts. Shape(*batch_shape, k)prior (
Tensor) – Prior pseudo-count. Set to ones for no a priori. Shape(k,).mode (
MultinomialTestModeLike) – SeeMultinomialTestMode.
- Returns:
test (
Callable[[Tensor], Tensor]) – Deviation test functiontest(observed: Tensor) -> Tensor, whereobservedcan be batched. Depending onmode, this function defines thetest“expectations” by aggregating the observedcountsand theprior.- Raises:
ValueError – If
countsis a scalar.ValueError – If
modevalue is unsupported.
Note
In principle, if
countsindeed represents counting results, thencounts.sum(-1)should hold the same value for every sample. This is not checked at runtime. The same applies toobserved.