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

Feat/improve integer indexes #1191

Merged
merged 35 commits into from
Sep 22, 2022
Merged

Feat/improve integer indexes #1191

merged 35 commits into from
Sep 22, 2022

Conversation

hrzn
Copy link
Contributor

@hrzn hrzn commented Sep 6, 2022

Solves #974 and fixes a series of small issues we had with integer-indexed series:

  • The function TimeSeries.get_index_at_point() was not behaving as expected on integer-indexed series with index not starting at 0
  • The historical forecasts was having an issue when building the resulting series (when last_points_only=True) with stride>1.
  • The time index of forecasts and a few other things were basically incorrect when the underlying RangeIndex was having a step > 1.
  • The TimeSeries.gaps() method had an issue with integer-indexed series.
  • Some unit tests were missing to spot these issues
  • Added unit tests for RegressionModels with integer series. Previously part of the logic was relying on [] indexing, which would have failed for series not starting at 0 or with step > 1. Fixes Feat/improve integer indexes #1191

This PR supersedes #1180, which I'll now close.

@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2022

Codecov Report

Base: 93.71% // Head: 93.77% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (3d105d6) compared to base (a162e21).
Patch coverage: 97.22% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1191      +/-   ##
==========================================
+ Coverage   93.71%   93.77%   +0.05%     
==========================================
  Files          83       83              
  Lines        8416     8414       -2     
==========================================
+ Hits         7887     7890       +3     
+ Misses        529      524       -5     
Impacted Files Coverage Δ
darts/models/forecasting/forecasting_model.py 96.49% <ø> (ø)
darts/timeseries.py 92.34% <95.23%> (+0.31%) ⬆️
darts/models/forecasting/regression_model.py 98.33% <100.00%> (+0.65%) ⬆️
darts/utils/data/encoder_base.py 93.69% <100.00%> (ø)
darts/utils/timeseries_generation.py 95.86% <100.00%> (+0.03%) ⬆️
...arts/models/forecasting/torch_forecasting_model.py 87.45% <0.00%> (-0.05%) ⬇️
darts/models/forecasting/block_rnn_model.py 98.24% <0.00%> (-0.04%) ⬇️
darts/models/forecasting/nhits.py 99.27% <0.00%> (-0.01%) ⬇️
darts/datasets/__init__.py 100.00% <0.00%> (ø)
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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 and thanks a lot! These are very important changes.
I tested most of the changes and added some minor comments.

What do you think in general of adding some examples (not in this PR) for the most of "get" methods for documentation? Could be helpful for the user as some of these methods have quite different behavior depending on input and underlying series.

darts/models/forecasting/forecasting_model.py Outdated Show resolved Hide resolved
darts/timeseries.py Show resolved Hide resolved
darts/models/forecasting/forecasting_model.py Outdated Show resolved Hide resolved
darts/tests/test_timeseries.py Outdated Show resolved Hide resolved
darts/tests/test_timeseries.py Outdated Show resolved Hide resolved
darts/tests/utils/test_timeseries_generation.py Outdated Show resolved Hide resolved
darts/tests/utils/test_timeseries_generation.py Outdated Show resolved Hide resolved
darts/timeseries.py Show resolved Hide resolved
darts/timeseries.py Outdated Show resolved Hide resolved
@@ -3974,6 +4011,15 @@ def __getitem__(

.. warning::
slices use pandas convention of including both ends of the slice.

Notes
Copy link
Collaborator

Choose a reason for hiding this comment

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

As getitem gets more complex, I believe now would be a good point either to add examples for all cases (probably better) or a userguide. Would probably make more sense in another PR.
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely agree! #1227

hrzn and others added 6 commits September 19, 2022 20:28
Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
Co-authored-by: Dennis Bader <dennis.bader@gmx.ch>
@hrzn hrzn merged commit d56c10f into master Sep 22, 2022
@madtoinou madtoinou deleted the feat/improve-integer-indexes branch July 5, 2023 21:55
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.

3 participants