rcs#
- openstef_beam.metrics.metrics_deterministic.rcs(y_true: NDArray[floating], y_pred_lower_q: NDArray[floating], y_pred_upper_q: NDArray[floating]) float[source]#
Calculate the Regression Coverage Score (RCS) for prediction intervals.
RCS measures the fraction of observed values that fall within the predicted lower and upper quantile bounds. A calibrated 90% prediction interval should have an RCS close to 0.9.
- Parameters:
- Returns:
The fraction of observations inside the interval. Values closer to the nominal interval coverage indicate better calibration.
- Return type:
Example
Evaluate coverage of a P10-P90 prediction interval
>>> import numpy as np >>> y_true = np.array([100, 120, 110, 130]) >>> y_pred_lower_q = np.array([90, 115, 105, 125]) >>> y_pred_upper_q = np.array([110, 125, 115, 128]) >>> rcs(y_true, y_pred_lower_q, y_pred_upper_q) 0.75
Note
The interval bounds are inclusive: observations equal to either bound are counted as covered.