pytorch-forecasting
pytorch-forecasting copied to clipboard
[ENH] Support tuning any model and extend LSTMModel in docs to support multi-target datasets
Description
This PR fixes my own issues:
- https://github.com/jdb78/pytorch-forecasting/issues/1440
- https://github.com/jdb78/pytorch-forecasting/issues/1448
It allows to tune "any" model, generalizing the optimize_hypetparameters function from TemporalFusionTransformer model, and it also add a "better" LSTMModel than the one shown in the documentation, which I tried to use on a multi-target dataset without success. My version does work on multi-target datasets, thanks to an extension to AutoRegressiveBaseModel.
My version of AutoRegressiveBaseModel inherits from the original to override a couple of methods. I should've probably just edited the original, but I'd like to hear your feedback before doing that. I'm also sure there was a simpler way for AutoRegressiveBaseModel to work with multi-target data. When I tried to just run the Documentation's example of LSTMModel but on a multi-target dummy dataset, it just did not work out of the box.
Checklist
- Linked issues: https://github.com/jdb78/pytorch-forecasting/issues/1440 , https://github.com/jdb78/pytorch-forecasting/issues/1448
- Amended changelog for large changes (and added myself there as contributor)
- Added/modified tests: tests/test_models/test_tuning.py
- [Yes] Used pre-commit hooks when committing to ensure that code is compliant with hooks. Install hooks with
pre-commit install. To run hooks independent of commit, executepre-commit run --all-files
Make sure to have fun coding!
What's blocking this?
Check out this pull request on ![]()
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
I don't understand why the docs test fails (I haven't changed anything there) and why the Black test fails if I ran black and on my machine black --check . returns:
>> black --check .
All done! ✨ 🍰 ✨
54 files would be left unchanged.
Codecov Report
Attention: 35 lines in your changes are missing coverage. Please review.
Comparison is base (
b3fcf86) 90.19% compared to head (652a4c1) 89.96%. Report is 8 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #1449 +/- ##
==========================================
- Coverage 90.19% 89.96% -0.23%
==========================================
Files 30 33 +3
Lines 4724 4985 +261
==========================================
+ Hits 4261 4485 +224
- Misses 463 500 +37
| Flag | Coverage Δ | |
|---|---|---|
| cpu | 89.96% <86.79%> (-0.23%) |
:arrow_down: |
| pytest | 89.96% <86.79%> (-0.23%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.