mean_pinball_loss#
- openstef_beam.metrics.metrics_probabilistic.mean_pinball_loss(y_true: ndarray[tuple[Any, ...], dtype[floating]], y_pred: ndarray[tuple[Any, ...], dtype[floating]], quantiles: list[Quantile], sample_weight: ndarray[tuple[Any, ...], dtype[floating]] | None = None) float[source]#
Calculate the Mean Pinball Loss for quantile forecasts.
The Pinball Loss is a proper scoring rule for evaluating quantile forecasts. It penalizes under- and over-predictions differently based on the quantile level.
- Parameters:
y_true (
ndarray[tuple[Any,...],dtype[floating]]) – Observed values with shape (num_samples,) or (num_samples, num_quantiles).y_pred (
ndarray[tuple[Any,...],dtype[floating]]) – Predicted quantiles with shape (num_samples, num_quantiles). Each column corresponds to predictions for a specific quantile level.quantiles (
list[Quantile]) – Quantile levels with shape (num_quantiles,). Must be sorted in ascending order and contain values in [0, 1].sample_weight (
ndarray[tuple[Any,...],dtype[floating]] |None) – Optional weights for each sample with shape (num_samples,).y_true
y_pred
quantiles
sample_weight
- Returns:
The weighted average Pinball Loss across all samples and quantiles. Lower values indicate better forecast quality.
- Return type: