Skip to content

Fix error msg for alpha in PinballLoss#1018

Open
Ahmed-Zahran02 wants to merge 2 commits intosktime:mainfrom
Ahmed-Zahran02:fix-error-msg-PinballLoss
Open

Fix error msg for alpha in PinballLoss#1018
Ahmed-Zahran02 wants to merge 2 commits intosktime:mainfrom
Ahmed-Zahran02:fix-error-msg-PinballLoss

Conversation

@Ahmed-Zahran02
Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fix #966

What does this implement/fix? Explain your changes.

It fixes the ambiguity of the error message in PinballLoss to show which alpha values requested and missing from the predictions.

Copilot AI review requested due to automatic review settings March 31, 2026 06:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the diagnosability of PinballLoss when a user supplies an explicit alpha and y_pred does not contain predictions for all requested quantile levels.

Changes:

  • Compute the set of missing quantile levels (missing_alphas) when alpha is provided.
  • Raise a ValueError whose message now includes the missing alpha values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skpro/metrics/_classes.py Outdated
Comment thread skpro/metrics/_classes.py Outdated
if len(missing_alphas) > 0:
msg = (
f"Not all quantile values in alpha are available in y_pred. "
f"Missing alphas: {missing_alphas.tolist()}"
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change updates user-visible error text for missing quantiles, but existing tests only assert that a ValueError is raised (they don't check the message). Please extend the existing quantile metric negative test to assert the error message includes the missing alpha values (and, if added, the requested/available lists) so future refactors don't regress the improved diagnostics.

Suggested change
f"Missing alphas: {missing_alphas.tolist()}"
f"Missing alphas: {missing_alphas.tolist()}. "
f"Requested alphas: {list(alpha)}. "
f"Available alphas in y_pred: {list(y_pred_alphas)}"

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] Make PinballLoss alpha mismatch error message more informative

2 participants