Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions skpro/metrics/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ def _evaluate_by_index(self, y_true, y_pred, **kwargs):
if alpha is None:
alphas = y_pred_alphas
else:
# if alpha was provided, check whether they are predicted
# if not all alpha are observed, raise a ValueError
if not np.isin(alpha, y_pred_alphas).all():
# todo: make error msg more informative
# which alphas are missing
msg = "not all quantile values in alpha are available in y_pred"
missing_alphas = np.setdiff1d(alpha, y_pred_alphas)
if len(missing_alphas) > 0:
msg = (
f"{type(self).__name__}: Not all quantile values in `alpha` are "
f"available in `y_pred`. Requested alphas: {list(alpha)}; "
f"available alphas: {list(y_pred_alphas)}; "
f"missing alphas: {missing_alphas.tolist()}"
)
raise ValueError(msg)
else:
alphas = alpha
Expand Down
Loading