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

Refactor/forecast residuals fn #1223

Merged
merged 19 commits into from
Sep 21, 2022
Merged

Conversation

eliane-maalouf
Copy link
Contributor

Fixes #1127.

Summary

  • Added past/future covariates in forecast_model/residuals()
  • added UnitTest for residuals (tests/utils/test_residuals.py) - moved an already existing function testing residuals from tests/models/forecasting/test_backtesting.py)

Other Information

  • Corrected documentation for x_64 environment emulation on Apple M1 processors in INSTALL.md and CONTRIBUTING.md

Copy link
Contributor

@hrzn hrzn left a comment

Choose a reason for hiding this comment

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

Looks good 👍 I only added a suggestion to add one more unit test (testing the actual residual computations with covariates).

series._assert_univariate()
try:
series._assert_univariate()
except (AttributeError, TypeError):
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -0,0 +1,75 @@
import numpy as np
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for the separate test file

past_covariates=past_covariates,
future_covariates=future_covariates,
)
# it seems that models can be fit with data objects that are not necessarily TimeSeries, but residuals() will
Copy link
Contributor

Choose a reason for hiding this comment

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

The only other possible type should be Sequence[TimeSeries] 😅

target_series,
past_covariates=past_covariates,
future_covariates=future_covariates,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also add a test case where the residuals computation carries out successfully with past and/or future covariates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok will do

@hrzn
Copy link
Contributor

hrzn commented Sep 19, 2022

Some of the unit tests fail, but this is because #1228

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2022

Codecov Report

Base: 93.71% // Head: 93.70% // Decreases project coverage by -0.00% ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1223      +/-   ##
==========================================
- Coverage   93.71%   93.70%   -0.01%     
==========================================
  Files          83       83              
  Lines        8416     8410       -6     
==========================================
- Hits         7887     7881       -6     
  Misses        529      529              
Impacted Files Coverage Δ
darts/models/forecasting/forecasting_model.py 96.57% <100.00%> (+0.07%) ⬆️
darts/timeseries.py 91.96% <0.00%> (-0.07%) ⬇️
...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%> (ø)

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
Contributor

@hrzn hrzn left a comment

Choose a reason for hiding this comment

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

LGTM, nice :)

@eliane-maalouf eliane-maalouf merged commit 8bb9959 into master Sep 21, 2022
@eliane-maalouf eliane-maalouf deleted the refactor/forecast_residuals_fn branch October 13, 2022 08:27
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.

add past_covariates and future_covariates to residuals()
3 participants