compute_symmetric_quantile_metrics#

openstef_beam.evaluation.evaluation_helper.compute_symmetric_quantile_metrics(y_true: NDArray[floating], y_pred: NDArray[floating], quantiles: Sequence[Quantile], metric_name: str, metric: SymmetricQuantileMetric, *, selected_quantiles: Sequence[Quantile] | None = None, **metric_kwargs: Any) dict[Quantile | Literal['global'], dict[str, Annotated[float, BeforeValidator(func=_convert_none_to_nan, json_schema_input_type=PydanticUndefined)]]][source]#

Compute metrics for quantiles that have a complementary quantile.

For each selected quantile, the helper finds its complementary quantile (1 - q), orders the corresponding predictions as lower and upper bounds, and computes the supplied interval metric. Median quantiles and quantiles without a complementary counterpart are skipped.

Parameters:
  • y_true (NDArray[floating]) – True values with shape (num_samples,).

  • y_pred (NDArray[floating]) – Predicted values with shape (num_samples, num_quantiles).

  • quantiles (Sequence[Quantile]) – Quantiles used for prediction, in the same order as y_pred columns.

  • metric_name (str) – Name under which to store the computed metric.

  • metric (Callable[..., float]) – Callable that computes a metric from true values and interval bounds.

  • selected_quantiles (Sequence[Quantile] | None) – Optional subset of quantiles to compute metrics for.

  • metric_kwargs (Any) – Additional keyword arguments passed to the metric callable.

  • y_true

  • y_pred

  • quantiles

  • metric_name

  • metric

  • selected_quantiles

  • metric_kwargs

Returns:

QuantileMetricsDict containing metric values for matching quantile pairs.

Return type:

dict[Union[Quantile, Literal['global']], dict[str, float]]