[BUG] Fix dimension assumption in QuantileLoss.loss for 2D inputs#2113
[BUG] Fix dimension assumption in QuantileLoss.loss for 2D inputs#2113Kundan-CR7 wants to merge 3 commits intosktime:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2113 +/- ##
=======================================
Coverage ? 86.63%
=======================================
Files ? 165
Lines ? 9732
Branches ? 0
=======================================
Hits ? 8431
Misses ? 1301
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Kundan-CR7 thanks for the contribution! Your change is noted, and I think it would make sense to have |
PranavBhatP
left a comment
There was a problem hiding this comment.
Add separate units tests for metrics in the already existing ..\tests\test_metrics.py file.
|
@PranavBhatP Thanks a lot for the clarification and the quick review! That makes sense — I understand the original assumption about the input always being This is my first PR in this repository, so I really appreciate the feedback and guidance. |
|
I have a doubt: |
Reference Issues/PRs
Fixes #1795
What does this implement/fix? Explain your changes.
This PR fixes a dimension assumption in
QuantileLoss.loss.The current implementation concatenates per-quantile losses using:
This assumes that
y_predis always 3D (e.g., [batch, time, quantiles]).However, when
y_predis 2D (e.g., [batch, quantiles]), this raises:To make the implementation dimension-safe, concatenation has been changed to:
Since the quantile dimension is always the last dimension of
y_pred, usingdim=-1ensures compatibility with both:This resolves the issue without altering the loss computation logic.
What should a reviewer concentrate their feedback on?
dim=2withdim=-1Did you add any tests for the change?
Yes.
Added regression tests in
test_quantile_loss.pyto verify:IndexErrorAll existing tests pass locally:
Any other comments?
This change only removes the fixed-dimension assumption and makes concatenation robust to varying input dimensionality.
No changes were made to the quantile loss computation itself.
PR checklist