Skip to content
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

Improvement/Adds temporal_hidden_size_past and temporal_hidden_size_future hyperparams to TiDEModel #2416

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

eschibli
Copy link
Contributor

@eschibli eschibli commented Jun 17, 2024

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Implements #2408

Summary

Adds hyperparameters controlling hidden layer size for the past covariate and future covariate feature encoders in TiDEModel. Previously these were controlled by hidden_size.

Other Information

Defaults were set to 64. In the original google-research implementation the default temporal_hidden_size_past was set to 64, and there was no future covariate encoder.

Alternatively, to preserve default behavior, defaults could be set to 128.

Other comments:

Oops I see my rebase failed horribly - should I drop this PR and do it over from a fresh branch?

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.80%. Comparing base (1de2973) to head (480a9b0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2416      +/-   ##
==========================================
- Coverage   93.81%   93.80%   -0.02%     
==========================================
  Files         139      139              
  Lines       14694    14684      -10     
==========================================
- Hits        13785    13774      -11     
- Misses        909      910       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Hi @eschibli, and thanks for this PR.

In order to make it backwards compatible (e.g. loading a TiDEModel save from an older Darts version into the new one), we need to change the default behavior of the hyperparmeters.

Comment on lines 82 to 83
temporal_hidden_size_past: int,
temporal_hidden_size_future: int,
Copy link
Collaborator

Choose a reason for hiding this comment

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

In order for this to be backward compatible (loading a saved TiDEModel in the new Darts version), we need to set a default of None here. If temproal_hidden_size_past/future is None, then we need to use the hidden_size.

Suggested change
temporal_hidden_size_past: int,
temporal_hidden_size_future: int,
temporal_hidden_size_past: Optional[int] = None,
temporal_hidden_size_future: Optional[int] = None,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change made

Comment on lines 157 to 158
self.temporal_hidden_size_past = temporal_hidden_size_past
self.temporal_hidden_size_future = temporal_hidden_size_future
Copy link
Collaborator

Choose a reason for hiding this comment

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

From comment above

Suggested change
self.temporal_hidden_size_past = temporal_hidden_size_past
self.temporal_hidden_size_future = temporal_hidden_size_future
self.temporal_hidden_size_past = temporal_hidden_size_past or hidden_size
self.temporal_hidden_size_future = temporal_hidden_size_future or hidden_size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change made

@@ -375,6 +383,8 @@ def __init__(
hidden_size: int = 128,
temporal_width_past: int = 4,
temporal_width_future: int = 4,
temporal_hidden_size_past: int = 64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comments here as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change made

will bypass feature projection and use the raw feature data.
temporal_hidden_size_past
Copy link
Collaborator

Choose a reason for hiding this comment

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

mention here that by default, it uses the same value as temporal_width_*, but that it is recommended setting a lower value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change made

@eschibli eschibli requested a review from dennisbader July 8, 2024 21:58
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.

[FEATURE REQUEST] Add temporal_hidden_past and temporal_hidden_future hyperparams to TiDEModel
3 participants