torchcell.losses.distributional.pinball

pinball(pred_q: Tensor, target: Tensor, taus: Tensor) → Tensor[source]

Pinball (quantile / check) loss for a set of predicted quantiles.

\(\rho_\tau(u)=\max(\tau u,(\tau-1)u)\) with \(u=y-\hat q_\tau\). Training a full grid of tau fits the conditional quantile function directly (distribution-free); the mean pinball over an even tau grid approximates the empirical CRPS.

Parameters:
  • pred_q – Predicted quantiles [..., K] (last axis indexes taus).

  • target – Observations [...] (broadcast against the quantile axis).

  • taus – Quantile levels [K] in (0, 1).

Returns:

Elementwise pinball [..., K] (callers reduce over K and features).