-
Notifications
You must be signed in to change notification settings - Fork 700
[ENH] Consistent 3D output for single-target point predictions in TimeXer
v1.
#1936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
TimeXer
v1 and predictTimeXer
v1.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1936 +/- ##
=======================================
Coverage ? 87.07%
=======================================
Files ? 136
Lines ? 8612
Branches ? 0
=======================================
Hits ? 7499
Misses ? 1113
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am worried that we are removing tests but not adding tests.
If we are removing an API stepout, then we should remove a stepout in the testes to match, no?
it was an unintended removal, happened by mistake, sorry. The code stays the same in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so it was a bug! Good that we do reviews.
Related question: is there a stepout we can remove now?
…to a single handling block
with that question in mind, I tried tweaking with a few of the tensor shapes, and I was able to reduce the number of stepouts. now, the default return is a 3d tensor - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mention you reduced the number of stepouts, but I do not see a change in tests - did you forget to push them?
no i meant stepouts in the actual model code. We were handling quantile and non-quantile predictions separately inside the model. But with this PR, I have unified the handling to a single format for all types of metrics used (quantile or point). The code for the tests ultimately remains the same, since we are testing the output shape of predict API for If there is a misunderstanding, please let me know. |
Yes, I meant tests. I think thta one of the following must be true:
|
Seems that all the shape are well managed. Here you are using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeating my review request:
- if there was a stepout for the forecaster in tests, please remove the stepout
- if there was no stepout, please review the tests why there was no stepout and/or why they still passed
I see what you mean. This PR's changes are solely a patch on the existing set of tests specific to |
So the workflow would be: add the missing test for the old version (in a separate PR) -> replace with tests for the new output format for timexer (in this PR)? |
I would say, add the test for the post-1936 state. Then, hopefully, only |
I was going through this change request and trying to implement it with the workflow you just suggested, I don't understand which class you are referring to. I am not editing the tests in |
That is indeed what I meant: there should be a test that checks the expected output of every class - |
It can't fail as right now the test framework checks for both the contracts- 2D and 3D output format |
@phoeenniixx, that´s exactly what I mean with "removing the stepout". Going forward, the stepout for 2D should be removed, no? |
For that to happen, we need to fix returns for |
Again, then the definition of "non-conformance" that we have applied to |
So then my proposal would be to add the test in and skip both |
Yeah we can do this, it will require just one line change in if not isinstance(class, (TimeXer,NBeats)):
# perform the output test for 3D And afterwards, we fix |
@phoeenniixx, that would work! Although I do not like skips per model inside tests, these are easy to forget there. This indicates that maybe there is too much being tested in a single test method. |
I agree, we need some refactoring. I think we should raise an issue as a checklist, so that we dont forget anything. In v2 also, there are a lot of things that can be refactored in test-framework. But these things imo, should have a lower priority, we should first achieve a stable (and complete) API for v2, just save the things along the way that needs refactoring, and we can do this afterwards? As we would anyway need a full refactoring round after first complete v2 like connecting v1 and v2 etc. We can do these things at that time? |
For now, we should focus on API conformance for v1 and design and implementation for v2... |
agreed - what is, in your opinion, @phoeenniixx, the quickest, simplest way that we ensure:
|
I could think of two ways:
IMO, the best way for now is the Hardcode way because this "non-conformance" is a special case that happened due to no concrete contract in past, but from now on, we have one concrete contract - the output format should be 3D for single target. And we are already aware of the non-conformant models, we should just raise an issue for them (for But this is mainly because we right now have a lot on our plate, but we should avoid such things in future, once we have a stable API for v2. |
What do you think about this @fkiraly, @PranavBhatP ? |
ok, @PranavBhatP, I agree with the arguments that we can cut corners because the skips will only apply to the models in the past. For this I think we should open an issue for nbeats and explicitly mention that the test internal skip should be removed. The first option would imply changes to the framework or tests first - they need refactoring, and I think this would be th better option, if we could make a wish - but it would cause scope creep, and feels like a distraction at the moment. What do you think, @PranavBhatP. |
Yes, this approach makes sense as a temporary fix, I will try changing the code for this. In this PR do I only skip tests for |
So, from what I can understand, you are solving the issue for |
yes, @phoeenniixx, that is what I had understood |
Then in that case the PR #1951 handles the changes specific to the tests in |
yeah i think this makes sense, right @fkiraly ? |
yes, sounds like a good plan to me too |
…1936 (#1951) #### What does this implement/fix? Explain your changes. Adds the test for the output shapes of the forward method of `TimeXer`. The test checks the output contract for the model, which is being implemented in #1936. Currently skipped under `test_timexer.py` due to obvious causes of failure i.e current version of model on main is still not updated to the required output contract.
Reference Issues/PRs
What does this implement/fix? Explain your changes.
Small change in the code to provide a 3d output tensor for point predictions with 3rd dimension set to 1. With this change the output contract for
TimeXer
is(batch_size, predictions, 1)
where the 3rd dimension indicates a single target.(batch_size, predictions, num_quantiles)
where the 3rd dimension indicates the number of quantiles for which the output is generated.What should a reviewer concentrate their feedback on?
PR checklist
pre-commit install
.To run hooks independent of commit, execute
pre-commit run --all-files