-
Notifications
You must be signed in to change notification settings - Fork 904
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
Feature add activation to BlockRNN (#2492) #2504
Feature add activation to BlockRNN (#2492) #2504
Conversation
* Added support for specifying PyTorch activation functions (`ReLU`, `Sigmoid`, `Tanh`, or `None`) in the `BlockRNNModel`. * Ensured that activation functions are applied between fully connected layers, but not as the final layer. * Implemented a check to raise an error if an activation function is set but the model only contains one linear layer. * Updated documentation to reflect the new activation parameter and usage examples. * Added test cases to verify the correct application of activation functions and to handle edge cases.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2504 +/- ##
==========================================
- Coverage 93.79% 93.75% -0.05%
==========================================
Files 139 139
Lines 14741 14738 -3
==========================================
- Hits 13827 13818 -9
- Misses 914 920 +6 ☔ View full report in Codecov by Sentry. |
Should a warning be raised if |
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.
Thank you for the PR, some minor comments about the sanity checks.
Co-authored-by: madtoinou <32447896+madtoinou@users.noreply.github.com>
Co-authored-by: madtoinou <32447896+madtoinou@users.noreply.github.com>
* Add a check that raise an error when activation is None and hidden_fc_sizes is greater than 0
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.
Hi @SzymonCogiel and thanks for this great PR 🚀 We're close, I just had a couple more suggestions. Mainly that I would set a default activation, to make it easier for the user in case he uses multiple fc layers.
@@ -430,11 +449,40 @@ def encode_year(idx): | |||
logger=logger, | |||
) | |||
|
|||
raise_if( |
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.
With the comment from above, we could remove this check
), | ||
logger=logger, | ||
) | ||
raise_if( |
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.
and we could remove this as well
Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
* _check_ckpt_parameters * Remove redundant raise_if
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.
Thanks for the updates @SzymonCogiel. Last little adaptions and then we're ready to merge :)
Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
* Revert docstring _BlockRNNModule
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.
Looks good now, thanks @SzymonCogiel 🚀
* Feature add activation to BlockRNN (unit8co#2492) * Added support for specifying PyTorch activation functions (`ReLU`, `Sigmoid`, `Tanh`, or `None`) in the `BlockRNNModel`. * Ensured that activation functions are applied between fully connected layers, but not as the final layer. * Implemented a check to raise an error if an activation function is set but the model only contains one linear layer. * Updated documentation to reflect the new activation parameter and usage examples. * Added test cases to verify the correct application of activation functions and to handle edge cases. * Update darts/models/forecasting/block_rnn_model.py Co-authored-by: madtoinou <32447896+madtoinou@users.noreply.github.com> * Update darts/models/forecasting/block_rnn_model.py Co-authored-by: madtoinou <32447896+madtoinou@users.noreply.github.com> * Feature add activation to BlockRNN (unit8co#2492) * Add a check that raise an error when activation is None and hidden_fc_sizes is greater than 0 * Update darts/models/forecasting/block_rnn_model.py Co-authored-by: Dennis Bader <dennis.bader@gmx.ch> * Feature add activation to BlockRNN (unit8co#2492) * _check_ckpt_parameters * Remove redundant raise_if * Update darts/models/forecasting/block_rnn_model.py Co-authored-by: Dennis Bader <dennis.bader@gmx.ch> * Feature add activation to BlockRNN (unit8co#2492) * Revert docstring _BlockRNNModule --------- Co-authored-by: madtoinou <32447896+madtoinou@users.noreply.github.com> Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
Checklist before merging this PR:
Fixes #2492 .
Summary
ReLU
,Sigmoid
,Tanh
, orNone
) in theBlockRNNModel
.Other Information
Consider using a logging warning instead of raising an error if an activation function is set but the model only contains one linear layer.