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 counts and the prior \(\alpha\) is defined by alpha.

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) – Shape batch_shape. The returned div.dtype is torch.result_type(counts, alpha) if at least one of counts of alpha is of floating type, torch.float otherwise.

Raises:
  • ValueError – If counts is a scalar.

  • ValueError – If counts has inconsistent sums along the last axis.