crps

static QRNN.crps(y_pred, y_test, quantiles)[source]

Compute the Continuous Ranked Probability Score (CRPS) for given quantile predictions.

This function uses a piece-wise linear fit to the approximate posterior CDF obtained from the predicted quantiles in y_pred to approximate the continuous ranked probability score (CRPS):

\[CRPS(\mathbf{y}, x) = \int_{-\infty}^\infty (F_{x | \mathbf{y}}(x') - \mathrm{1}_{x < x'})^2 \: dx'\]
Parameters
  • y_pred (numpy.array) – Array of shape (n, k) containing the k estimated quantiles for each of the n predictions.

  • y_test (numpy.array) – Array containing the n true values, i.e. samples of the true conditional distribution estimated by the QRNN.

  • quantiles – 1D array containing the k quantile fractions \(\tau\) that correspond to the columns in y_pred.

Returns

n-element array containing the CRPS values for each of the predictions in y_pred.