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

fix: datetime_attribute account for 0 or 1-indexing of the attributes #2242

Merged
merged 19 commits into from Mar 1, 2024

Conversation

madtoinou
Copy link
Collaborator

@madtoinou madtoinou commented Feb 21, 2024

Fixes #2219.

Summary

  • datetime_attribute_timeseries() was not taking into account the indexing of the attribute (1 for month, day or week for example), resulting in a shift of the "zeroed" columns
  • 0-indexing is enforced for all the encodings (1-indexed attributes are shifted by one)

Other Information

  • added some tests

@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.97%. Comparing base (ccd0d42) to head (ad76339).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2242      +/-   ##
==========================================
+ Coverage   93.95%   93.97%   +0.02%     
==========================================
  Files         135      135              
  Lines       13501    13499       -2     
==========================================
+ Hits        12685    12686       +1     
+ Misses        816      813       -3     

☔ 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.

Very nice @madtoinou thanks a lot 🚀

Had some minor suggestions. I think we should make the first "step" of each freq start at 0 for cyclic encodings (month=1 should result in sin(0), cos(0), similar to hour=0)

darts/utils/timeseries_generation.py Outdated Show resolved Hide resolved
darts/tests/utils/test_timeseries_generation.py Outdated Show resolved Hide resolved
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.

Another great PR, thanks @madtoinou 🚀

@madtoinou madtoinou merged commit 62d9200 into master Mar 1, 2024
9 checks passed
@madtoinou madtoinou deleted the fix/date_attr branch March 1, 2024 16:06
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.

[BUG] datetime_attribute_timeseries does not create correct hot encoding
4 participants