dirmult_surprise#
- scio.scores.utils.dirmult_surprise(counts, alpha)[source]#
Compute DCM surprise.
Entropic surprise for the Dirichlet Compound Multinomial distribution \(\mathrm{DirMult}(n, \alpha)\), where \(n\) is implicitly defined by
countsand the prior \(\alpha\) is defined byalpha.- Parameters:
counts (
Tensor) – Integers counts that sum up to the same \(n\geqslant 1\) for every sample. Shape(*batch_shape, k).alpha (
Tensor) – Dirichlet prior, interpreted as pseudocount. Shape(k,).
- Returns:
res (
Tensor) – Shapebatch_shape. The returneddiv.dtypeistorch.result_type(counts, alpha)if at least one ofcountsofalphais of floating type,torch.floatotherwise.- Raises:
ValueError – If
countsis a scalar.ValueError – If
countshas inconsistent sums along the last axis.