pymc.WeightedZeroSumNormal#

class pymc.WeightedZeroSumNormal(name, *args, rng=None, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, default_transform=UNSET, **kwargs)[source]#

Normal distribution where the last axis is constrained to sum to zero under weights.

Generalizes ZeroSumNormal: draws satisfy sum(weights * value) = 0 along the last axis instead of sum(value) = 0. Writing \(u = w / \|w\|\),

\[WZSN(\sigma, w) = N\Big(0, \sigma^2 (I_n - u u^T)\Big)\]

With equal weights this is exactly ZeroSumNormal with one zero-sum axis. Only a single constrained axis (the last) is supported.

Parameters:
sigmatensor_like of float

Scale parameter (sigma > 0), the standard deviation of the underlying unconstrained Normal distribution. Defaults to 1. It cannot vary along the constrained axis.

weightstensor_like

1-d vector of strictly positive weights defining the constraint. Its length defines the support shape.

Methods

WeightedZeroSumNormal.dist([sigma])

Create a tensor variable corresponding to the cls distribution.