Skip to main content

gaussian

gaussian(
    f,
    *,
    kind,
    sigma=1.0,
    targets=None,
    generator=None,
    mc_samples=1,
    grouping='full',
)

Factors of the Gaussian negative log-likelihood, whose Hessian is diag(1 / sigma^2).

The exact square root is 1 / sigma on the diagonal. An MC draw is eps / (sigma sqrt(S)) with eps ~ N(0, I), and the empirical factor is (y - f) / sigma^2 at the targets.

Parameters

Name Type Description Default
f Tensor Predicted means [N, ..., K]. The last axis holds the columns, the others positions. required
kind Kind "exact", "mc" or "empirical". required
sigma float | Tensor Standard deviation, positive: a number or a tensor broadcastable to f (one per output, say). 1.0
targets Tensor | None Targets of f’s shape. Needed for "empirical". None
generator torch.Generator | None Random generator for "mc". None
mc_samples int Number of draws S for "mc". 1
grouping Grouping How exact factors of several positions are grouped. 'full'

Returns

Name Type Description
OutputFactors Factors [E, *f.shape].

Raises

Name Type Description
ValueError Unknown kind or grouping, or mc_samples < 1.
FactorError f has no output axis, sigma is not positive or does not broadcast to f, or the targets are missing or of the wrong shape.