torchcell.losses.distributional.gaussian_crps

gaussian_crps(mu: Tensor, sigma: Tensor, target: Tensor) → Tensor[source]

Closed-form CRPS of a Gaussian \(\mathcal N(\mu,\sigma)\) vs observations.

\[\mathrm{CRPS}(\mathcal N(\mu,\sigma), y) = \sigma\Big[z\,(2\Phi(z)-1) + 2\varphi(z) - \tfrac{1}{\sqrt\pi}\Big], \quad z=\frac{y-\mu}{\sigma},\]

with \(\Phi,\varphi\) the standard-normal CDF/PDF (Gneiting & Raftery 2007). CRPS is a PROPER scoring rule – minimized in expectation only by the true predictive distribution – and, unlike Gaussian NLL, carries no \(1/\sigma^2\) term, so \(\sigma\) cannot drive the loss to \(-\infty\) (the collapse that NLL/beta-NLL patch around). Value is in the units of y.

Parameters:
  • mu – Predicted mean, any shape.

  • sigma – Predicted standard deviation (STRICTLY positive), broadcastable to mu.

  • target – Observations, broadcastable to mu.

Returns:

Elementwise CRPS with the broadcast shape of the inputs (callers reduce).